add pic_strcmp
This commit is contained in:
parent
0fa61b6a4a
commit
9a73ba707c
|
@ -28,6 +28,7 @@ void pic_str_set(pic_state *, pic_str *, size_t, char);
|
|||
|
||||
pic_str *pic_strcat(pic_state *, pic_str *, pic_str *);
|
||||
pic_str *pic_substr(pic_state *, pic_str *, size_t, size_t);
|
||||
int pic_strcmp(pic_state *, pic_str *, pic_str *);
|
||||
|
||||
pic_value pic_format(pic_state *, const char *, ...);
|
||||
pic_value pic_vformat(pic_state *, const char *, va_list);
|
||||
|
|
12
src/string.c
12
src/string.c
|
@ -103,6 +103,14 @@ pic_substr(pic_state *pic, pic_str *str, size_t s, size_t e)
|
|||
return pic_str_new(pic, buf, len);
|
||||
}
|
||||
|
||||
int
|
||||
pic_strcmp(pic_state *pic, pic_str *str1, pic_str *str2)
|
||||
{
|
||||
UNUSED(pic);
|
||||
|
||||
return strcmp(str1->str, str2->str);
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_vfformat(pic_state *pic, XFILE *file, const char *fmt, va_list ap)
|
||||
{
|
||||
|
@ -269,9 +277,7 @@ pic_str_string_set(pic_state *pic)
|
|||
if (! pic_str_p(argv[i])) { \
|
||||
return pic_false_value(); \
|
||||
} \
|
||||
if (! (strcmp(pic_str_ptr(argv[i-1])->str, \
|
||||
pic_str_ptr(argv[i])->str) \
|
||||
op 0)) { \
|
||||
if (! (pic_strcmp(pic, pic_str_ptr(argv[i-1]), pic_str_ptr(argv[i])) op 0)) { \
|
||||
return pic_false_value(); \
|
||||
} \
|
||||
} \
|
||||
|
|
Loading…
Reference in New Issue