remove blob.h

This commit is contained in:
Yuichi Nishiwaki 2016-02-19 00:20:15 +09:00
parent cfc32a1b15
commit aa2121b61c
6 changed files with 21 additions and 13 deletions

View File

@ -188,8 +188,7 @@ pic_socket_socket_send(pic_state *pic)
pic_value obj;
struct pic_blob *bv;
const unsigned char *cursor;
int flags = 0;
size_t remain, written;
int flags = 0, remain, written;
struct pic_socket_t *sock;
pic_get_args(pic, "ob|i", &obj, &bv, &flags);
@ -198,8 +197,7 @@ pic_socket_socket_send(pic_state *pic)
sock = pic_socket_data_ptr(obj);
ensure_socket_is_open(pic, sock);
cursor = bv->data;
remain = bv->len;
cursor = pic_blob(pic, bv, &remain);
written = 0;
errno = 0;
while (remain > 0) {

View File

@ -3,6 +3,7 @@
*/
#include "picrin.h"
#include "picrin/object.h"
struct pic_blob *
pic_blob_value(pic_state *pic, const unsigned char *buf, int len)
@ -18,6 +19,13 @@ pic_blob_value(pic_state *pic, const unsigned char *buf, int len)
return bv;
}
unsigned char *
pic_blob(pic_state PIC_UNUSED(*pic), struct pic_blob *blob, int *len)
{
*len = blob->len;
return blob->data;
}
static pic_value
pic_blob_bytevector_p(pic_state *pic)
{

View File

@ -258,7 +258,6 @@ int pic_str_hash(pic_state *, struct pic_string *);
#include "picrin/state.h"
#include "picrin/blob.h"
#include "picrin/cont.h"
#include "picrin/data.h"
#include "picrin/dict.h"

View File

@ -9,14 +9,6 @@
extern "C" {
#endif
struct pic_blob {
PIC_OBJECT_HEADER
unsigned char *data;
int len;
};
#define pic_blob_ptr(v) ((struct pic_blob *)pic_obj_ptr(v))
#if defined(__cplusplus)
}
#endif

View File

@ -10,6 +10,16 @@ extern "C" {
#endif
/* blob */
struct pic_blob {
PIC_OBJECT_HEADER
unsigned char *data;
int len;
};
#define pic_blob_ptr(v) ((struct pic_blob *)pic_obj_ptr(v))
/* string */
struct pic_string {

View File

@ -3,6 +3,7 @@
*/
#include "picrin.h"
#include "picrin/object.h"
static pic_value
pic_assert_port(pic_state *pic)