s/struct pic_string/pic_str/g
This commit is contained in:
parent
ca4276afc7
commit
131440b1d0
|
@ -164,8 +164,9 @@ bool pic_interned_p(pic_state *, pic_sym);
|
|||
|
||||
char *pic_strdup(pic_state *, const char *);
|
||||
char *pic_strndup(pic_state *, const char *, size_t);
|
||||
struct pic_string *pic_str_new(pic_state *, const char *, size_t); /* the 2nd arg may be NULL for empty string */
|
||||
struct pic_string *pic_str_new_cstr(pic_state *, const char *);
|
||||
pic_str *pic_str_new(pic_state *, const char * /* nullable */, size_t);
|
||||
pic_str *pic_str_new_cstr(pic_state *, const char *);
|
||||
|
||||
pic_value pic_format(pic_state *, const char *, ...);
|
||||
pic_value pic_vformat(pic_state *, const char *, va_list);
|
||||
pic_value pic_vfformat(pic_state *, XFILE *, const char *, va_list);
|
||||
|
|
23
src/string.c
23
src/string.c
|
@ -8,10 +8,10 @@
|
|||
#include "picrin/pair.h"
|
||||
#include "picrin/port.h"
|
||||
|
||||
struct pic_string *
|
||||
pic_str *
|
||||
pic_str_new(pic_state *pic, const char *cstr, size_t len)
|
||||
{
|
||||
struct pic_string *str;
|
||||
pic_str *str;
|
||||
char *copy;
|
||||
|
||||
if (cstr) {
|
||||
|
@ -20,12 +20,18 @@ pic_str_new(pic_state *pic, const char *cstr, size_t len)
|
|||
copy = (char *)pic_alloc(pic, len);
|
||||
}
|
||||
|
||||
str = (struct pic_string *)pic_obj_alloc(pic, sizeof(struct pic_string), PIC_TT_STRING);
|
||||
str = (pic_str *)pic_obj_alloc(pic, sizeof(pic_str), PIC_TT_STRING);
|
||||
str->len = len;
|
||||
str->str = copy;
|
||||
return str;
|
||||
}
|
||||
|
||||
pic_str *
|
||||
pic_str_new_cstr(pic_state *pic, const char *cstr)
|
||||
{
|
||||
return pic_str_new(pic, cstr, strlen(cstr));
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_vfformat(pic_state *pic, XFILE *file, const char *fmt, va_list ap)
|
||||
{
|
||||
|
@ -119,15 +125,6 @@ pic_format(pic_state *pic, const char *fmt, ...)
|
|||
return objs;
|
||||
}
|
||||
|
||||
struct pic_string *
|
||||
pic_str_new_cstr(pic_state *pic, const char *cstr)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = strlen(cstr);
|
||||
return pic_str_new(pic, cstr, len);
|
||||
}
|
||||
|
||||
static pic_value
|
||||
pic_str_string_p(pic_state *pic)
|
||||
{
|
||||
|
@ -230,7 +227,7 @@ pic_str_string_copy(pic_state *pic)
|
|||
size_t len, start, end, i;
|
||||
char *str;
|
||||
int n;
|
||||
struct pic_string *copy;
|
||||
pic_str *copy;
|
||||
|
||||
n = pic_get_args(pic, "s|ii", &str, &len, &start, &end);
|
||||
|
||||
|
|
Loading…
Reference in New Issue