remove blob.h
This commit is contained in:
parent
cfc32a1b15
commit
aa2121b61c
|
@ -188,8 +188,7 @@ pic_socket_socket_send(pic_state *pic)
|
||||||
pic_value obj;
|
pic_value obj;
|
||||||
struct pic_blob *bv;
|
struct pic_blob *bv;
|
||||||
const unsigned char *cursor;
|
const unsigned char *cursor;
|
||||||
int flags = 0;
|
int flags = 0, remain, written;
|
||||||
size_t remain, written;
|
|
||||||
struct pic_socket_t *sock;
|
struct pic_socket_t *sock;
|
||||||
|
|
||||||
pic_get_args(pic, "ob|i", &obj, &bv, &flags);
|
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);
|
sock = pic_socket_data_ptr(obj);
|
||||||
ensure_socket_is_open(pic, sock);
|
ensure_socket_is_open(pic, sock);
|
||||||
|
|
||||||
cursor = bv->data;
|
cursor = pic_blob(pic, bv, &remain);
|
||||||
remain = bv->len;
|
|
||||||
written = 0;
|
written = 0;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
while (remain > 0) {
|
while (remain > 0) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "picrin.h"
|
#include "picrin.h"
|
||||||
|
#include "picrin/object.h"
|
||||||
|
|
||||||
struct pic_blob *
|
struct pic_blob *
|
||||||
pic_blob_value(pic_state *pic, const unsigned char *buf, int len)
|
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;
|
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
|
static pic_value
|
||||||
pic_blob_bytevector_p(pic_state *pic)
|
pic_blob_bytevector_p(pic_state *pic)
|
||||||
{
|
{
|
||||||
|
|
|
@ -258,7 +258,6 @@ int pic_str_hash(pic_state *, struct pic_string *);
|
||||||
|
|
||||||
#include "picrin/state.h"
|
#include "picrin/state.h"
|
||||||
|
|
||||||
#include "picrin/blob.h"
|
|
||||||
#include "picrin/cont.h"
|
#include "picrin/cont.h"
|
||||||
#include "picrin/data.h"
|
#include "picrin/data.h"
|
||||||
#include "picrin/dict.h"
|
#include "picrin/dict.h"
|
||||||
|
|
|
@ -9,14 +9,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,6 +10,16 @@ extern "C" {
|
||||||
#endif
|
#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 */
|
/* string */
|
||||||
|
|
||||||
struct pic_string {
|
struct pic_string {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "picrin.h"
|
#include "picrin.h"
|
||||||
|
#include "picrin/object.h"
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
pic_assert_port(pic_state *pic)
|
pic_assert_port(pic_state *pic)
|
||||||
|
|
Loading…
Reference in New Issue