diff options
author | H. Peter Anvin <hpa@zytor.com> | 2016-05-10 02:54:15 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2016-05-10 02:59:04 -0700 |
commit | b157701b17c38fe3f84aab6a43ed34d17e5c91d2 (patch) | |
tree | 8d58a052aae0daa2d5090d0ce58bf0933e0d8f68 | |
parent | c74a70988520bb25d5fbde22881f43c4e2b06603 (diff) | |
download | nasm-b157701b17c38fe3f84aab6a43ed34d17e5c91d2.tar.gz |
quote: make the input argument to nasm_quote() const
Whereas nasm_unquote() unquotes the argument in place, nasm_quote()
has to allocate a new string (since the new string will *always* be
longer than the old string!) Make the old string const since we're
making a copy anyway.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | quote.c | 5 | ||||
-rw-r--r-- | quote.h | 2 |
2 files changed, 4 insertions, 3 deletions
@@ -42,9 +42,10 @@ #include "nasmlib.h" #include "quote.h" -char *nasm_quote(char *str, size_t len) +char *nasm_quote(const char *str, size_t len) { - char c, c1, *p, *q, *nstr, *ep; + const char *p, *ep; + char c, c1, *q, *nstr; unsigned char uc; bool sq_ok, dq_ok; size_t qlen; @@ -36,7 +36,7 @@ #include "compiler.h" -char *nasm_quote(char *str, size_t len); +char *nasm_quote(const char *str, size_t len); size_t nasm_unquote(char *str, char **endptr); char *nasm_skip_string(char *str); |