Skip to content

Commit bb8f7de

Browse files
committed
Use the precise buffer length for a mstring of long.
1 parent 2e3a94a commit bb8f7de

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mstring.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ mstring::mstring(const char *str1, const char *str2, const char *str3,
107107
fRef.acquire();
108108
}
109109

110-
mstring::mstring(long n):
111-
fRef(size_t(23))
112-
{
113-
snprintf(fRef->fStr, 23, "%ld", n);
110+
mstring::mstring(long n) {
111+
char buf[24];
112+
snprintf(buf, 24, "%ld", n);
113+
fRef.create(buf, strlen(buf));
114114
fRef.acquire();
115115
}
116116

0 commit comments

Comments
 (0)