New macro Strcatc and Strnulterm

This commit is contained in:
Tatsuya Kinoshita
2021-04-05 22:36:45 +09:00
parent 068e2c2784
commit fbaa526b8b

2
Str.h
View File

@@ -69,6 +69,8 @@ void Strgrow(Str s);
#define STR_SIZE_MAX (INT_MAX / 32)
#define Strcat_char(x,y) (((x)->length+1>=STR_SIZE_MAX)?0:(((x)->length+1>=(x)->area_size)?Strgrow(x),0:0,(x)->ptr[(x)->length++]=(y),(x)->ptr[(x)->length]=0))
#define Strcatc(x,y) ((x)->ptr[(x)->length++]=(y))
#define Strnulterm(x) ((x)->ptr[(x)->length]=0)
#define Strcmp(x,y) strcmp((x)->ptr,(y)->ptr)
#define Strcmp_charp(x,y) strcmp((x)->ptr,(y))
#define Strncmp(x,y,n) strncmp((x)->ptr,(y)->ptr,(n))