s/struct pic_string/pic_str/g

This commit is contained in:
Yuichi Nishiwaki 2014-02-21 18:05:59 +09:00
parent ca4276afc7
commit 131440b1d0
2 changed files with 13 additions and 15 deletions

View File

@ -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);

View File

@ -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);