Reorganize headers again
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "iomux_impl.h"
|
||||
#include <ucore/iomux_impl.h>
|
||||
|
||||
//epoll (linux specific) IO mux.
|
||||
//We stuff the struct IOMuxFD pointer in the event.data.ptr slot
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "iomux_impl.h"
|
||||
#include <ucore/iomux_impl.h>
|
||||
|
||||
|
||||
//dispatchers for the IOMux implementations */
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "iomux_impl.h"
|
||||
#include "ucore_utils.h"
|
||||
#include <ucore/iomux_impl.h>
|
||||
#include <ucore/ucore_utils.h>
|
||||
|
||||
#define IOMUX_GROW_CHUNK (32)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <stdint.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
static const uint8_t basecode[128] =
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
static const char basecode[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
#define PAD '='
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
size_t
|
||||
uc_ascii2bcd(const char *ascii, unsigned char *bcdout, unsigned char filler)
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include "ucore_bitvec.h"
|
||||
#include <ucore/ucore_bitvec.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define likely(expr) __builtin_expect((expr), 1)
|
||||
|
||||
+44
-3
@@ -1,6 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "ucore_buffer.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <ucore/ucore_buffer.h>
|
||||
|
||||
GBuf*
|
||||
uc_new_gbuf(size_t initsz)
|
||||
@@ -43,7 +45,6 @@ uc_gbuf_unref(GBuf *buf)
|
||||
int
|
||||
uc_gbuf_append(GBuf *buf,void *data,size_t len)
|
||||
{
|
||||
unsigned char *d = data;
|
||||
unsigned char *gbuf;
|
||||
|
||||
if(buf->len - buf->used < len)
|
||||
@@ -51,12 +52,52 @@ uc_gbuf_append(GBuf *buf,void *data,size_t len)
|
||||
return -1;
|
||||
|
||||
gbuf = buf->buf;
|
||||
memcpy(gbuf + buf->used,d,len);
|
||||
memcpy(gbuf + buf->used, data, len);
|
||||
buf->used += len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uc_gbuf_printf(GBuf *buf, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_list apc;
|
||||
int rc = 0;
|
||||
int remaining;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
//increment buffer if snprintf indicates the results were truncated
|
||||
do {
|
||||
|
||||
va_copy(apc, ap);
|
||||
char *gbuf;
|
||||
|
||||
remaining = uc_gbuf_remaining(buf);
|
||||
if(rc >= remaining) {
|
||||
if(uc_gbuf_grow(buf, buf->len + (rc - remaining) + 1)) {
|
||||
rc = -1;
|
||||
va_end(apc);
|
||||
break;
|
||||
}
|
||||
remaining = uc_gbuf_remaining(buf);
|
||||
}
|
||||
|
||||
gbuf = buf->buf;
|
||||
|
||||
rc = vsnprintf(gbuf + buf->used, remaining, fmt, apc);
|
||||
va_end(apc);
|
||||
|
||||
} while(rc >= remaining);
|
||||
|
||||
if(rc > 0)
|
||||
buf->used += rc;
|
||||
|
||||
va_end(ap);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
uc_gbuf_grow(GBuf *buf, size_t addlen)
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_hash.h"
|
||||
#include <ucore/ucore_hash.h>
|
||||
|
||||
static const uint32_t crc32_table[256] = {
|
||||
0x0,0x4C11DB7,0x9823B6E,0xD4326D9,0x130476DC,0x17C56B6B,0x1A864DB2,0x1E475005,0x2608EDB8,0x22C9F00F,0x2F8AD6D6,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_hash.h"
|
||||
#include <ucore/ucore_hash.h>
|
||||
|
||||
uint32_t
|
||||
uc_djbhash(const char *str)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_hash.h"
|
||||
#include <ucore/ucore_hash.h>
|
||||
|
||||
uint32_t
|
||||
uc_elfhash(const char *str, uint32_t len)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_math.h"
|
||||
#include <ucore/ucore_math.h>
|
||||
|
||||
uint32_t
|
||||
uc_gcd_32(uint32_t a, uint32_t b)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_math.h"
|
||||
#include <ucore/ucore_math.h>
|
||||
|
||||
uint64_t
|
||||
uc_gcd_64(uint64_t a, uint64_t b)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <string.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
int
|
||||
getfields(char *str, char **args, int max, int mflag, const char *set)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <stdint.h>
|
||||
#include "ucore_hash.h"
|
||||
#include <ucore/ucore_hash.h>
|
||||
|
||||
uint64_t
|
||||
uc_hash64shift(uint64_t key)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_hash.h"
|
||||
#include <ucore/ucore_hash.h>
|
||||
|
||||
uint32_t
|
||||
uc_hashuint(uint32_t a)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <string.h>
|
||||
#include "ucore_heapsort.h"
|
||||
#include <ucore/ucore_heapsort.h>
|
||||
|
||||
static void
|
||||
uc_sift(unsigned char *base, size_t start, size_t count, size_t width,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
static const char hx_chars[] = "0123456789ABCDEF" ;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
char *
|
||||
uc_human_bytesz(uint64_t bytes, char *result, size_t result_len)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
#include <errno.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/queue.h>
|
||||
#include "ucore_logging.h"
|
||||
#include <ucore/ucore_logging.h>
|
||||
|
||||
|
||||
struct uc_log_destination {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*Copyright (c) 2004 Nils O. Selåsdal <NOS {on} Utel {dot} no> */
|
||||
/*Straight forward attempt at a Mersenne Twister PRNG */
|
||||
|
||||
#include "ucore_mersenne_twister.h"
|
||||
#include <ucore/ucore_mersenne_twister.h>
|
||||
|
||||
|
||||
/*Beware , pollution. But the names are from the spec */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "ucore_hash.h"
|
||||
#include <ucore/ucore_hash.h>
|
||||
|
||||
// 'm' and 'r' are mixing constants generated offline.
|
||||
// They're not really 'magic', they just happen to work well.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_math.h"
|
||||
#include <ucore/ucore_math.h>
|
||||
|
||||
/*
|
||||
Euler's Totient Function is denoted by the Greek letter phi, and is defined as follows:
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_math.h"
|
||||
#include <ucore/ucore_math.h>
|
||||
|
||||
/*
|
||||
Euler's Totient Function is denoted by the Greek letter phi, and is defined as follows:
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_hash.h"
|
||||
#include <ucore/ucore_hash.h>
|
||||
|
||||
uint32_t
|
||||
uc_pjwhash(const char *str,size_t len)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#include <stddef.h>
|
||||
#include "ucore_rbtree.h"
|
||||
#include <ucore/ucore_rbtree.h>
|
||||
//modified from generated code of tree.h
|
||||
|
||||
static void
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "ucore_read_file.h"
|
||||
#include <ucore/ucore_read_file.h>
|
||||
|
||||
#define CHUNK_SZ 1024
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "ucore_salloc.h"
|
||||
#include <ucore/ucore_salloc.h>
|
||||
|
||||
typedef struct Chunk Chunk;
|
||||
struct Chunk {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "ucore_hash.h"
|
||||
#include <ucore/ucore_hash.h>
|
||||
|
||||
uint32_t
|
||||
uc_sax_hash(void *key, size_t len)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
|
||||
char*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
char*
|
||||
uc_sprintbc(char *result, unsigned char value)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
char*
|
||||
uc_sprintbll(char *result, unsigned long long value)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
char*
|
||||
uc_sprintbs(char *result, unsigned short value)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <ctype.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
void
|
||||
uc_str_tolower(char *s)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <ctype.h>
|
||||
#include "ucore_string.h"
|
||||
#include <ucore/ucore_string.h>
|
||||
|
||||
void
|
||||
uc_str_toupper(char *s)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
#include "ucore_threadqueue.h"
|
||||
#include <ucore/ucore_threadqueue.h>
|
||||
|
||||
|
||||
int uc_thread_queue_init(struct uc_threadqueue *queue, long max_elements)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#include <assert.h>
|
||||
#include "ucore_timers.h"
|
||||
#include <ucore/ucore_timers.h>
|
||||
|
||||
|
||||
static int timers_cmp(const void *a_, const void *b_)
|
||||
|
||||
Reference in New Issue
Block a user