Commit-ID: b157701b17c38fe3f84aab6a43ed34d17e5c91d2
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b157701b17c38fe3f84aab6a43ed34d17e5c91d2
Author: H. Peter Anvin <hp...@zy...>
AuthorDate: Tue, 10 May 2016 02:54:15 -0700
Committer: H. Peter Anvin <hp...@zy...>
CommitDate: Tue, 10 May 2016 02:59:04 -0700
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 <hp...@zy...>
---
quote.c | 5 +++--
quote.h | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/quote.c b/quote.c
index d1cbfd4..75a9372 100644
--- a/quote.c
+++ b/quote.c
@@ -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;
diff --git a/quote.h b/quote.h
index 13089cb..2d8ce87 100644
--- a/quote.h
+++ b/quote.h
@@ -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);
|