Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

What is the best way to reallocate memory for char array? (4 replies)

$
0
0
For example I've allocated memory for char *str:

str = ngx_pnalloc(r->pool, len1);

Then I've added some data to "str":

ngx_sprintf(str, "abc");

How should I reallocate this memory? Should I use:

str = ngx_pnalloc(r->pool, len2);

? And I would like to keep the str's "abc" data as well.

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>