From 25593b5e6fea76ed7c08db586924032c0810c27e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Sun, 7 Nov 2010 00:47:39 +0200 Subject: squark: reorganize sources to src directory --- blob.h | 63 --------------------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 blob.h (limited to 'blob.h') diff --git a/blob.h b/blob.h deleted file mode 100644 index 76afed7..0000000 --- a/blob.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef BLOB_H -#define BLOB_H - -#include - -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - -#if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ < 96 -#define __builtin_expect(x, expected_value) (x) -#endif - -#ifndef likely -#define likely(x) __builtin_expect((!!(x)),1) -#endif - -#ifndef unlikely -#define unlikely(x) __builtin_expect((!!(x)),0) -#endif - -typedef struct blob { - char *ptr; - unsigned int len; -} blob_t; - -#define BLOB_PTR_LEN(ptr,len) (blob_t){(void*)(ptr), (len)} -#define BLOB_PTR_PTR(beg,end) BLOB_PTR_LEN((beg),(end)-(beg)+1) -#define BLOB_BUF(buf) (blob_t){(void*)(buf), sizeof(buf)} -#define BLOB_STRLEN(str) (blob_t){(str), strlen(str)} -#define BLOB_STR_INIT(str) {(str), sizeof(str)-1} -#define BLOB_STR(str) (blob_t) BLOB_STR_INIT(str) -#define BLOB_NULL (blob_t){NULL, 0} - -static inline int blob_is_null(blob_t b) -{ - return b.len == 0; -} - -char *blob_cstr_dup(blob_t b); -blob_t blob_dup(blob_t b); -int blob_cmp(blob_t a, blob_t b); -unsigned long blob_inet_addr(blob_t buf); - -blob_t blob_pushed(blob_t buffer, blob_t left); -void blob_push(blob_t *b, blob_t d); -void blob_push_lower(blob_t *b, blob_t d); -void blob_push_byte(blob_t *b, unsigned char byte); -void blob_push_uint(blob_t *to, unsigned int value, int radix); -void blob_push_ctime(blob_t *to, time_t t); -void blob_push_hexdump(blob_t *to, blob_t binary); -void blob_push_urldecode(blob_t *to, blob_t url); -void blob_push_urlencode(blob_t *to, blob_t url); -blob_t blob_pull(blob_t *b, int len); -void blob_pull_skip(blob_t *b, int len); -int blob_pull_matching(blob_t *b, blob_t e); -unsigned int blob_pull_uint(blob_t *b, int radix); -blob_t blob_pull_spn(blob_t *b, const blob_t spn); -blob_t blob_pull_cspn(blob_t *b, const blob_t cspn); - -blob_t blob_expand_head(blob_t *b, blob_t limits, unsigned char sep); -blob_t blob_expand_tail(blob_t *b, blob_t limits, unsigned char sep); -blob_t blob_shrink_tail(blob_t *b, blob_t limits, unsigned char sep); - -#endif -- cgit v1.2.3