Re: cvs: php4 /main SAPI.c
| From: | Sascha Schumann | Date: | Mon, 10 Feb 2003 21:33:36 +0000 |
| Subject: | Re: cvs: php4 /main SAPI.c | ||
| References: | 1 2 3 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-18633@lists.php.net to get a copy of this message | ||
> Ah, Ok then. I see i should have made spprintf's interface to support
> an estimated size....but then !! i see the real problem here, i overlooked
> it when rewriting the stuff....yes it is really!! slow....but how about this
> change:
Have you looked at smart_strs? That's the way to go, if you
want to get rid of nasty size calculations/checks and ugly
memcpy calls.
> + fprintf(stderr, "Using(%d); '%s'\n", slen, s);\
> + memcpy(xbuf->nextb, s, slen); \
> + xbuf->nextb += slen; \
> + cc += slen; \
> + s += slen; \
The API also provides for converting longs to strings. E.g.
smart_str dest = {0};
long foo;
..
smart_str_append_long(&dest, foo);
- Sascha