Remove ucore_ prefix from headers and source files
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ ucore_env = env.Clone()
|
||||
#substitute @version_xx@ strings
|
||||
subst_version_info = dict(('@' + key + '@', version_info[key]) for key in version_info)
|
||||
subst_version_info['@build_host@'] = platform.node()
|
||||
ucore_env.Substfile('ucore_version.c.in', SUBST_DICT = subst_version_info)
|
||||
ucore_env.Substfile('version.c.in', SUBST_DICT = subst_version_info)
|
||||
|
||||
sources = ucore_env.Glob('*.c')
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <execinfo.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ucore/ucore_backtrace.h>
|
||||
#include "ucore/backtrace.h"
|
||||
|
||||
#define MAX_BACKTRACE_SYMBOLS 96
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <stdint.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
static const uint8_t basecode[128] =
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
static const char basecode[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
#define PAD '='
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
size_t
|
||||
uc_ascii2bcd(const char *ascii, unsigned char *bcdout, unsigned char filler)
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <ucore/ucore_bitvec.h>
|
||||
#include "ucore/bitvec.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define likely(expr) __builtin_expect((expr), 1)
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <ucore/ucore_buffer.h>
|
||||
#include "ucore/buffer.h"
|
||||
|
||||
GBuf*
|
||||
uc_new_gbuf(size_t initsz)
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
#include "ucore/clock.h"
|
||||
#include "ucore/utils.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED __attribute__((__unused__))
|
||||
#else
|
||||
#define UNUSED
|
||||
#endif
|
||||
|
||||
static void uc_timeofday_now(struct UCoreClock *clock UNUSED, struct timeval *tv)
|
||||
{
|
||||
gettimeofday(tv, NULL);
|
||||
}
|
||||
|
||||
static void uc_time_now(struct UCoreClock *clock UNUSED, struct timeval *tv)
|
||||
{
|
||||
tv->tv_sec = time(NULL);
|
||||
tv->tv_usec = 0;
|
||||
}
|
||||
|
||||
struct UCoreClock uc_timeofday_clock = {
|
||||
.name = "gettimeofday",
|
||||
.now = uc_timeofday_now,
|
||||
};
|
||||
|
||||
struct UCoreClock uc_time_clock = {
|
||||
.name = "time",
|
||||
.now = uc_time_now,
|
||||
};
|
||||
|
||||
static void uc_cached_clock_now(struct UCoreClock *uclock UNUSED,
|
||||
struct timeval *tv)
|
||||
{
|
||||
struct UCoreCachedClock *cached_clock;
|
||||
cached_clock = CONTAINER_OF(uclock, struct UCoreCachedClock, clock),
|
||||
|
||||
*tv = cached_clock->cache;
|
||||
}
|
||||
|
||||
void uc_cached_clock_init(struct UCoreCachedClock *uclock, struct UCoreClock *real_clock)
|
||||
{
|
||||
uclock->clock.name = "cached clock";
|
||||
uclock->clock.now = uc_cached_clock_now;
|
||||
|
||||
uclock->real_clock = real_clock;
|
||||
|
||||
uc_cached_clock_update(uclock);
|
||||
}
|
||||
|
||||
void uc_cached_clock_update(struct UCoreCachedClock *uclock)
|
||||
{
|
||||
uclock->real_clock->now(&uclock->clock, &uclock->cache);
|
||||
}
|
||||
|
||||
static void uc_settable_clock_now(struct UCoreClock *uclock, struct timeval *tv)
|
||||
{
|
||||
struct UCoreSettableClock *cached_clock;
|
||||
cached_clock = CONTAINER_OF(uclock, struct UCoreSettableClock, clock),
|
||||
|
||||
*tv = cached_clock->now;
|
||||
}
|
||||
|
||||
void uc_settable_clock_init(struct UCoreSettableClock *uclock)
|
||||
{
|
||||
uclock->clock.name = "settable clock";
|
||||
uclock->clock.now = uc_settable_clock_now;
|
||||
|
||||
uclock->now.tv_sec = 0;
|
||||
uclock->now.tv_usec = 0;
|
||||
}
|
||||
|
||||
void uc_settable_clock_set_tv(struct UCoreSettableClock *uclock, const struct timeval *tv)
|
||||
{
|
||||
uclock->now = *tv;
|
||||
}
|
||||
|
||||
void uc_settable_clock_set(struct UCoreSettableClock *uclock, time_t secs, suseconds_t usecs)
|
||||
{
|
||||
uclock->now.tv_sec = secs;
|
||||
uclock->now.tv_usec = usecs;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_hash.h>
|
||||
#include "ucore/hash.h"
|
||||
|
||||
static const uint32_t crc32_table[256] = {
|
||||
0x0,0x4C11DB7,0x9823B6E,0xD4326D9,0x130476DC,0x17C56B6B,0x1A864DB2,0x1E475005,0x2608EDB8,0x22C9F00F,0x2F8AD6D6,
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_hash.h>
|
||||
#include "ucore/hash.h"
|
||||
|
||||
uint32_t
|
||||
uc_djbhash(const char *str)
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_hash.h>
|
||||
#include "ucore/hash.h"
|
||||
|
||||
uint32_t
|
||||
uc_elfhash(const char *str, uint32_t len)
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_math.h>
|
||||
#include "ucore/math.h"
|
||||
|
||||
uint32_t
|
||||
uc_gcd_32(uint32_t a, uint32_t b)
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_math.h>
|
||||
#include "ucore/math.h"
|
||||
|
||||
uint64_t
|
||||
uc_gcd_64(uint64_t a, uint64_t b)
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <string.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "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/ucore_hash.h>
|
||||
#include "ucore/hash.h"
|
||||
|
||||
uint64_t
|
||||
uc_hash64shift(uint64_t key)
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_hash.h>
|
||||
#include "ucore/hash.h"
|
||||
|
||||
uint32_t
|
||||
uc_hashuint(uint32_t a)
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <string.h>
|
||||
#include <ucore/ucore_heapsort.h>
|
||||
#include "ucore/heapsort.h"
|
||||
|
||||
static void
|
||||
uc_sift(unsigned char *base, size_t start, size_t count, size_t width,
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
static const char hx_chars[] = "0123456789ABCDEF" ;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
char *
|
||||
uc_human_bytesz(uint64_t bytes, char *result, size_t result_len)
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ucore/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
|
||||
|
||||
+2
-2
@@ -3,14 +3,14 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ucore/iomux_impl.h>
|
||||
#include <ucore/ucore_clock.h>
|
||||
#include "ucore/clock.h"
|
||||
|
||||
|
||||
//dispatchers for the IOMux implementations */
|
||||
|
||||
struct IOMux *iomux_create(enum IOMUX_TYPE type)
|
||||
{
|
||||
return iomux_create_ex(type, &ucore_timeofday_clock);
|
||||
return iomux_create_ex(type, &uc_timeofday_clock);
|
||||
}
|
||||
|
||||
struct IOMux *iomux_create_ex(enum IOMUX_TYPE type, struct UCoreClock *uclock)
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <ucore/iomux_impl.h>
|
||||
#include <ucore/ucore_utils.h>
|
||||
#include "ucore/iomux_impl.h"
|
||||
#include "ucore/utils.h"
|
||||
|
||||
#define IOMUX_GROW_CHUNK (32)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <errno.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/queue.h>
|
||||
#include <ucore/ucore_logging.h>
|
||||
#include "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/ucore_mersenne_twister.h>
|
||||
#include "ucore/mersenne_twister.h"
|
||||
|
||||
|
||||
/*Beware , pollution. But the names are from the spec */
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_hash.h>
|
||||
#include "ucore/hash.h"
|
||||
|
||||
// 'm' and 'r' are mixing constants generated offline.
|
||||
// They're not really 'magic', they just happen to work well.
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_math.h>
|
||||
#include "ucore/math.h"
|
||||
|
||||
/*
|
||||
Euler's Totient Function is denoted by the Greek letter phi, and is defined as follows:
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_math.h>
|
||||
#include "ucore/math.h"
|
||||
|
||||
/*
|
||||
Euler's Totient Function is denoted by the Greek letter phi, and is defined as follows:
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_hash.h>
|
||||
#include "ucore/hash.h"
|
||||
|
||||
uint32_t
|
||||
uc_pjwhash(const char *str,size_t len)
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <stddef.h>
|
||||
#include <ucore/ucore_rbtree.h>
|
||||
#include "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/ucore_read_file.h>
|
||||
#include "ucore/read_file.h"
|
||||
|
||||
#define CHUNK_SZ 1024
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <ucore/ucore_salloc.h>
|
||||
#include "ucore/salloc.h"
|
||||
|
||||
typedef struct Chunk Chunk;
|
||||
struct Chunk {
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ucore/ucore_hash.h>
|
||||
#include "ucore/hash.h"
|
||||
|
||||
uint32_t
|
||||
uc_sax_hash(void *key, size_t len)
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
|
||||
char*
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
char*
|
||||
uc_sprintbc(char *result, unsigned char value)
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
char*
|
||||
uc_sprintbll(char *result, unsigned long long value)
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
char*
|
||||
uc_sprintbs(char *result, unsigned short value)
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <ctype.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "ucore/string.h"
|
||||
|
||||
void
|
||||
uc_str_tolower(char *s)
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <ctype.h>
|
||||
#include <ucore/ucore_string.h>
|
||||
#include "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/ucore_threadqueue.h>
|
||||
#include "ucore/threadqueue.h"
|
||||
|
||||
/**
|
||||
* @param timeout a timeout duration
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <assert.h>
|
||||
#include <ucore/ucore_timers.h>
|
||||
#include <ucore/ucore_clock.h>
|
||||
#include "ucore/timers.h"
|
||||
#include "ucore/clock.h"
|
||||
|
||||
|
||||
static int timers_cmp(const void *a_, const void *b_)
|
||||
@@ -37,7 +37,7 @@ static void uc_timer_real_add(struct UCTimers *timers, struct UCTimer *timer)
|
||||
|
||||
void uc_timers_init(struct UCTimers *t)
|
||||
{
|
||||
uc_timers_init_ex(t, &ucore_timeofday_clock);
|
||||
uc_timers_init_ex(t, &uc_timeofday_clock);
|
||||
}
|
||||
|
||||
void uc_timers_init_ex(struct UCTimers *t, struct UCoreClock *uclock)
|
||||
@@ -1,82 +0,0 @@
|
||||
#include <ucore/ucore_clock.h>
|
||||
#include <ucore/ucore_utils.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED __attribute__((__unused__))
|
||||
#else
|
||||
#define UNUSED
|
||||
#endif
|
||||
|
||||
static void ucore_timeofday_now(struct UCoreClock *clock UNUSED, struct timeval *tv)
|
||||
{
|
||||
gettimeofday(tv, NULL);
|
||||
}
|
||||
|
||||
static void ucore_time_now(struct UCoreClock *clock UNUSED, struct timeval *tv)
|
||||
{
|
||||
tv->tv_sec = time(NULL);
|
||||
tv->tv_usec = 0;
|
||||
}
|
||||
|
||||
struct UCoreClock ucore_timeofday_clock = {
|
||||
.name = "gettimeofday",
|
||||
.now = ucore_timeofday_now,
|
||||
};
|
||||
|
||||
struct UCoreClock ucore_time_clock = {
|
||||
.name = "time",
|
||||
.now = ucore_time_now,
|
||||
};
|
||||
|
||||
static void ucore_cached_clock_now(struct UCoreClock *uclock UNUSED,
|
||||
struct timeval *tv)
|
||||
{
|
||||
struct UCoreCachedClock *cached_clock;
|
||||
cached_clock = CONTAINER_OF(uclock, struct UCoreCachedClock, clock),
|
||||
|
||||
*tv = cached_clock->cache;
|
||||
}
|
||||
|
||||
void ucore_cached_clock_init(struct UCoreCachedClock *uclock, struct UCoreClock *real_clock)
|
||||
{
|
||||
uclock->clock.name = "cached clock";
|
||||
uclock->clock.now = ucore_cached_clock_now;
|
||||
|
||||
uclock->real_clock = real_clock;
|
||||
|
||||
ucore_cached_clock_update(uclock);
|
||||
}
|
||||
|
||||
void ucore_cached_clock_update(struct UCoreCachedClock *uclock)
|
||||
{
|
||||
uclock->real_clock->now(&uclock->clock, &uclock->cache);
|
||||
}
|
||||
|
||||
static void ucore_settable_clock_now(struct UCoreClock *uclock, struct timeval *tv)
|
||||
{
|
||||
struct UCoreSettableClock *cached_clock;
|
||||
cached_clock = CONTAINER_OF(uclock, struct UCoreSettableClock, clock),
|
||||
|
||||
*tv = cached_clock->now;
|
||||
}
|
||||
|
||||
void ucore_settable_clock_init(struct UCoreSettableClock *uclock)
|
||||
{
|
||||
uclock->clock.name = "settable clock";
|
||||
uclock->clock.now = ucore_settable_clock_now;
|
||||
|
||||
uclock->now.tv_sec = 0;
|
||||
uclock->now.tv_usec = 0;
|
||||
}
|
||||
|
||||
void ucore_settable_clock_set_tv(struct UCoreSettableClock *uclock, const struct timeval *tv)
|
||||
{
|
||||
uclock->now = *tv;
|
||||
}
|
||||
|
||||
void ucore_settable_clock_set(struct UCoreSettableClock *uclock, time_t secs, suseconds_t usecs)
|
||||
{
|
||||
uclock->now.tv_sec = secs;
|
||||
uclock->now.tv_usec = usecs;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user