make stralloc_copym work

master
leitner 17 years ago
parent a8a5e9a3d5
commit cf900e97d3

@ -67,7 +67,7 @@ void stralloc_zero(stralloc* sa);
int stralloc_catm_internal(stralloc* sa,...); int stralloc_catm_internal(stralloc* sa,...);
#define stralloc_catm(sa,...) stralloc_catm_internal(sa,__VA_ARGS__,(char*)0) #define stralloc_catm(sa,...) stralloc_catm_internal(sa,__VA_ARGS__,(char*)0)
#define stralloc_copym(sa,...) (stralloc_zero(sa) && stralloc_catm_internal(sa,__VA_ARGS__,(char*)0)) #define stralloc_copym(sa,...) (stralloc_zero(sa), stralloc_catm_internal(sa,__VA_ARGS__,(char*)0))
/* stralloc_cat is analogous to stralloc_copy */ /* stralloc_cat is analogous to stralloc_copy */
int stralloc_cat(stralloc* sa,stralloc* in); int stralloc_cat(stralloc* sa,stralloc* in);

6
t.c

@ -318,7 +318,7 @@ int main(int argc,char* argv[]) {
rdtscl(c); rdtscl(c);
printf("%lu %lu\n",b-a,c-b); printf("%lu %lu\n",b-a,c-b);
#endif #endif
#if 1 #if 0
size_t size; size_t size;
char* buf=mmap_read(argv[1],&size); char* buf=mmap_read(argv[1],&size);
if (buf) { if (buf) {
@ -333,6 +333,7 @@ int main(int argc,char* argv[]) {
printf("%d %d\n",strcmp("foo","bar"),str_diff("foo","bar")); printf("%d %d\n",strcmp("foo","bar"),str_diff("foo","bar"));
printf("%d %d\n",strcmp("foo","üar"),str_diff("foo","üar")); printf("%d %d\n",strcmp("foo","üar"),str_diff("foo","üar"));
#endif #endif
#if 0
{ {
int16 a; int16 a;
int32 b; int32 b;
@ -348,6 +349,9 @@ int main(int argc,char* argv[]) {
assert(imult64(0x4000000000000000ll,2,&c)==0); assert(imult64(0x4000000000000000ll,2,&c)==0);
assert(imult64(0x3fffffffffffffffll,2,&c)==1 && c==0x7ffffffffffffffell); assert(imult64(0x3fffffffffffffffll,2,&c)==1 && c==0x7ffffffffffffffell);
} }
#endif
stralloc a;
printf("%d\n",stralloc_copym(&a,"fnord",", ","foo"));
return 0; return 0;
} }

Loading…
Cancel
Save