blob_new -> make_blob
This commit is contained in:
parent
e58f216b2d
commit
d08e401481
8
blob.c
8
blob.c
|
@ -25,7 +25,7 @@ pic_strdup(pic_state *pic, const char *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pic_blob *
|
struct pic_blob *
|
||||||
pic_blob_new(pic_state *pic, size_t len)
|
pic_make_blob(pic_state *pic, size_t len)
|
||||||
{
|
{
|
||||||
struct pic_blob *bv;
|
struct pic_blob *bv;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ pic_blob_make_bytevector(pic_state *pic)
|
||||||
if (b < 0 || b > 255)
|
if (b < 0 || b > 255)
|
||||||
pic_error(pic, "byte out of range");
|
pic_error(pic, "byte out of range");
|
||||||
|
|
||||||
blob = pic_blob_new(pic, k);
|
blob = pic_make_blob(pic, k);
|
||||||
for (i = 0; i < k; ++i) {
|
for (i = 0; i < k; ++i) {
|
||||||
blob->data[i] = b;
|
blob->data[i] = b;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ pic_blob_bytevector_copy(pic_state *pic)
|
||||||
end = from->len;
|
end = from->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
to = pic_blob_new(pic, end - start);
|
to = pic_make_blob(pic, end - start);
|
||||||
while (start < end) {
|
while (start < end) {
|
||||||
to->data[i++] = from->data[start++];
|
to->data[i++] = from->data[start++];
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ pic_blob_bytevector_append(pic_state *pic)
|
||||||
len += pic_blob_ptr(argv[i])->len;
|
len += pic_blob_ptr(argv[i])->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
blob = pic_blob_new(pic, len);
|
blob = pic_make_blob(pic, len);
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
for (i = 0; i < argc; ++i) {
|
for (i = 0; i < argc; ++i) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ struct pic_blob {
|
||||||
#define pic_blob_p(v) (pic_type(v) == PIC_TT_BLOB)
|
#define pic_blob_p(v) (pic_type(v) == PIC_TT_BLOB)
|
||||||
#define pic_blob_ptr(v) ((struct pic_blob *)pic_ptr(v))
|
#define pic_blob_ptr(v) ((struct pic_blob *)pic_ptr(v))
|
||||||
|
|
||||||
struct pic_blob *pic_blob_new(pic_state *, size_t);
|
struct pic_blob *pic_make_blob(pic_state *, size_t);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
4
port.c
4
port.c
|
@ -360,7 +360,7 @@ pic_port_get_output_bytevector(pic_state *pic)
|
||||||
xrewind(port->file);
|
xrewind(port->file);
|
||||||
|
|
||||||
/* copy to buf */
|
/* copy to buf */
|
||||||
blob = pic_blob_new(pic, endpos);
|
blob = pic_make_blob(pic, endpos);
|
||||||
xfread(blob->data, 1, endpos, port->file);
|
xfread(blob->data, 1, endpos, port->file);
|
||||||
|
|
||||||
return pic_obj_value(blob);
|
return pic_obj_value(blob);
|
||||||
|
@ -528,7 +528,7 @@ pic_port_read_blob(pic_state *pic)
|
||||||
|
|
||||||
assert_port_profile(port, PIC_PORT_IN | PIC_PORT_BINARY, PIC_PORT_OPEN, "read-bytevector");
|
assert_port_profile(port, PIC_PORT_IN | PIC_PORT_BINARY, PIC_PORT_OPEN, "read-bytevector");
|
||||||
|
|
||||||
blob = pic_blob_new(pic, k);
|
blob = pic_make_blob(pic, k);
|
||||||
|
|
||||||
i = xfread(blob->data, sizeof(char), k, port->file);
|
i = xfread(blob->data, sizeof(char), k, port->file);
|
||||||
if ( i == 0 ) {
|
if ( i == 0 ) {
|
||||||
|
|
2
read.c
2
read.c
|
@ -534,7 +534,7 @@ read_blob(pic_state *pic, struct pic_port *port, const char *str)
|
||||||
c = next(port);
|
c = next(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
blob = pic_blob_new(pic, len);
|
blob = pic_make_blob(pic, len);
|
||||||
for (i = 0; i < len; ++i) {
|
for (i = 0; i < len; ++i) {
|
||||||
blob->data[i] = dat[i];
|
blob->data[i] = dat[i];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue