summaryrefslogtreecommitdiff
path: root/quote.c
Commit message (Collapse)AuthorAgeFilesLines
* nasm_quote: Use memcpy only if length providedCyrill Gorcunov2010-09-071-1/+2
| | | | | | No need to call memcpy on empty strings Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* quote: use nasm_assert() instead of plain assert()H. Peter Anvin2009-07-151-2/+1
| | | | | | We have nasm_assert() now, so use it... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* quote: we must do unsigned comparison to get length of octal escapeH. Peter Anvin2009-07-151-11/+12
| | | | | | | | | When computing the length of an octal escape, we need to do an unsigned compare, otherwise we only allocate space for one character for bytes in the \200..\377 range, which is obviously incorrect. Reported-by: Ed Beroset <beroset@mindspring.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* quote: don't use sprintf()H. Peter Anvin2009-07-151-7/+17
| | | | | | | | | | There is no point in using sprintf(), and it adds the possibility of either bugs due to the output not matching what the byte count loop is expecting, or just cause people to freak out due to the notion that "sprinf is unsafe". Reported-by: Ed Beroset <beroset@mindspring.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Add copyright headers to the *.c/*.h files in the main directoryH. Peter Anvin2009-06-281-5/+34
| | | | | | | | | | Add copyright headers to the *.c/*.h files in the main directory. For files where I'm sure enough that we have all the approvals, I have given them the 2-BSD license, the others have been given the "LGPL for now" license header. Most of them can probably be changed after auditing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* quote: fix termination condition for hexadecimal escapesH. Peter Anvin2008-06-141-1/+1
| | | | Fix reversed test for hexadecimal escape sequence termination.
* Fix memory management issues with expanded %includeH. Peter Anvin2008-06-041-24/+40
| | | | | | | | Ownership of the filename string was a bit fuzzy, with the result that we were freeing it even though it was retained for use by __FILE__. Clean up a number of other memory management issues with the new quoting code, and change the stdscan implementation to one pass over the string.
* quote: Change the definition of escpH. Peter Anvin2008-06-021-7/+7
| | | | | | Semi-arbitrary change of the definition of escp to the beginning of the argument sequence instead of the initiator character. This may avoid an add in some code paths, and looks slightly cleaner to me.
* quote: be consistent in not using C escapes for bytesH. Peter Anvin2008-06-021-7/+7
| | | | | | We used numbers in nasm_unquote and C escapes in nasm_quote - use numbers in both places, just in case some C compiler does something weird with '\r' and (especially) '\n'.
* nasm_unquote: make code a little more uniformH. Peter Anvin2008-06-021-9/+9
| | | | | | | | | | Make the code a bit more consistent: - ndig is now always a countdown, and we always to the (p > escp+1) test to see if we got anything at all (this is to deal with stuff like \x without a digit.) - Add missing break; after 'v' (bug!). - Preinitialize nval to zero.
* quote: massively simplify nasm_skip_string()H. Peter Anvin2008-06-021-75/+7
| | | | | | Greatly simplify nasm_skip_string() by observing that for the purpose of string skipping, all states other than st_backslash are equivalent to st_start.
* qstring: backquoted strings seem to work now...H. Peter Anvin2008-06-011-0/+17
| | | | Hopefully backquoted strings should work correctly now.
* qstring: first cut at full quoted string support in the preprocessorH. Peter Anvin2008-06-011-0/+473
First attempt at properly handle quoted strings in the preprocessor. This also adds range support in %substr. No support in the assembler yet.