Remove extra '\' in verinum as_string().

This is generating an octal constant but there is no reason to have
three '\' characters. You need two to get the leading '\', but the
last one is not needed.
This commit is contained in:
Cary R 2010-05-13 18:27:41 -07:00 committed by Stephen Williams
parent d2be4293a3
commit 8caad6ed7c
1 changed files with 3 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998-2009 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -514,14 +514,13 @@ string verinum::as_string() const
if (char_val == '"' || char_val == '\\') { if (char_val == '"' || char_val == '\\') {
char tmp[5]; char tmp[5];
snprintf(tmp, sizeof tmp, "\\\%03o", char_val); snprintf(tmp, sizeof tmp, "\\%03o", char_val);
res = res + tmp; res = res + tmp;
} else if (char_val == ' ' || isgraph(char_val)) { } else if (char_val == ' ' || isgraph(char_val)) {
res = res + char_val; res = res + char_val;
} else { } else {
char tmp[5]; char tmp[5];
snprintf(tmp, sizeof tmp, "\\\%03o", char_val); snprintf(tmp, sizeof tmp, "\\%03o", char_val);
res = res + tmp; res = res + tmp;
} }
} }