Mercurial > hg > index.cgi
comparison lwasm/pseudo.c @ 281:cb24ffb23f7c
Make DTS not have problems if used multiple times.
Storing a pointer to a static return value for future use is dangerous since
the value might be overwritten by a subsequent call. Make DTS duplicate the
string it creates instead of relying on the static return value staying
valid.
author | William Astle <lost@l-w.ca> |
---|---|
date | Tue, 16 Jul 2013 21:48:49 -0600 |
parents | 4370370f38d1 |
children | b62af915c2cc |
comparison
equal
deleted
inserted
replaced
280:4370370f38d1 | 281:cb24ffb23f7c |
---|---|
43 | 43 |
44 skip_operand(p); | 44 skip_operand(p); |
45 l -> len = 0; | 45 l -> len = 0; |
46 | 46 |
47 tp = time(NULL); | 47 tp = time(NULL); |
48 t = l ->lstr = ctime(&tp); | 48 t = l ->lstr = lw_strdup(ctime(&tp)); |
49 | 49 |
50 while (*t) | 50 while (*t) |
51 { | 51 { |
52 if (*t == '\n') | 52 if (*t == '\n') |
53 break; | 53 break; |