add function fc_compare_string

pull/37/head
yuqing 2018-07-31 14:27:13 +08:00
parent 08dce9933e
commit 4ae9c8f55f
4 changed files with 18 additions and 3 deletions

View File

@ -37,7 +37,7 @@ HEADER_FILES = common_define.h hash.h chain.h logger.h base64.h \
skiplist_common.h system_info.h fast_blocked_queue.h \
php7_ext_wrapper.h id_generator.h char_converter.h \
char_convert_loader.h common_blocked_queue.h \
multi_socket_client.h skiplist_set.h
multi_socket_client.h skiplist_set.h fc_list.h
ALL_OBJS = $(FAST_STATIC_OBJS) $(FAST_SHARED_OBJS)

View File

@ -12,6 +12,7 @@
#define _COMMON_DEFINE_H_
#include <pthread.h>
#include <string.h>
#include <errno.h>
#ifdef WIN32
@ -206,6 +207,20 @@ typedef void* (*MallocFunc)(size_t size);
#define __gcc_attribute__(x)
#endif
static inline int fc_compare_string(const string_t *s1, const string_t *s2)
{
int result;
if (s1->len == s2->len) {
return memcmp(s1->str, s2->str, s1->len);
} else if (s1->len < s2->len) {
result = memcmp(s1->str, s2->str, s1->len);
return result == 0 ? -1 : result;
} else {
result = memcmp(s1->str, s2->str, s2->len);
return result == 0 ? 1 : result;
}
}
#ifdef __cplusplus
}
#endif

View File

@ -24,8 +24,6 @@ struct mpool_chain {
static struct mpool_chain g_mpool = {NULL, NULL};
#define ALIGNED_TASK_INFO_SIZE MEM_ALIGN(sizeof(struct fast_task_info))
int task_queue_init(struct fast_task_queue *pQueue)
{
int result;

View File

@ -19,6 +19,8 @@
#include "ioevent.h"
#include "fast_timer.h"
#define ALIGNED_TASK_INFO_SIZE MEM_ALIGN(sizeof(struct fast_task_info))
struct nio_thread_data;
struct fast_task_info;