summaryrefslogtreecommitdiffstats
path: root/blob.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-11-07 00:47:39 +0200
committerTimo Teräs <timo.teras@iki.fi>2010-11-07 00:47:39 +0200
commit25593b5e6fea76ed7c08db586924032c0810c27e (patch)
treeb632534eb96978ad620fee1e5a9a5d280e0b191e /blob.h
parente0450bd60a30ca944c16f84ee195463fd4aab653 (diff)
downloadsquark-25593b5e6fea76ed7c08db586924032c0810c27e.tar.bz2
squark-25593b5e6fea76ed7c08db586924032c0810c27e.tar.xz
squark: reorganize sources to src directory
Diffstat (limited to 'blob.h')
-rw-r--r--blob.h63
1 files changed, 0 insertions, 63 deletions
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 <string.h>
-
-#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