Re: [PATCH 1/3] Added generic string handling code.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Timo Sirainen
Date: Sunday, May 20, 2007 - 3:27 am

On 20.5.2007, at 13.01, Alex Riesen wrote:


It's easy to use the same str_*() functions to implement dynamic  
memory allocation. I think I could have done a bit different naming,  
like maybe:

extern struct string *str_alloc(unsigned int len);
extern void str_append(struct string *str, const char *cstr);

#define static_string(name, size) ..
#define sstr_append(str, cstr) str_append(&(str).string, cstr)



I would hardly call 8 extra bytes on stack heavier. Also if this was  
used everywhere I wouldn't be surprised if it made the code faster,  
because it would remove a lot of overflow checking code so more code  
will fit into L1 cache.
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/3] Added generic string handling code., Timo Sirainen, (Sat May 19, 7:24 pm)
Re: [PATCH 1/3] Added generic string handling code., Alex Riesen, (Sun May 20, 3:01 am)
Re: [PATCH 1/3] Added generic string handling code., Timo Sirainen, (Sun May 20, 3:27 am)
Re: [PATCH 1/3] Added generic string handling code., Petr Baudis, (Tue May 22, 6:40 am)
Re: [PATCH 1/3] Added generic string handling code., Timo Sirainen, (Wed May 23, 3:49 am)
Re: [PATCH 1/3] Added generic string handling code., Petr Baudis, (Wed May 23, 6:24 am)
Re: [PATCH 1/3] Added generic string handling code., Timo Sirainen, (Wed May 23, 6:56 am)