Skip to content

Commit 10361c7

Browse files
author
xiongziliang
committed
确保在一些老的编译器上编译通过
1 parent e18207f commit 10361c7

7 files changed

+9
-9
lines changed

src/include/tinybuf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ typedef struct T_tinybuf_value tinybuf_value;
2424
* 创建对象
2525
* @return 返回对象
2626
*/
27-
tinybuf_value *tinybuf_value_alloc();
27+
tinybuf_value *tinybuf_value_alloc(void);
2828

2929

3030
/**

src/include/tinybuf_buffer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ typedef struct T_buffer buffer;
1212
* 内部会调用buffer_init函数
1313
* @return buffer对象
1414
*/
15-
buffer *buffer_alloc();
15+
buffer *buffer_alloc(void);
1616
buffer *buffer_alloc2(const char *str,int len);
1717

1818
/**

src/include/tinybuf_log.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void set_log_level(e_log_lev lev);
4646
* 获取日志等级
4747
* @return 日志等级
4848
*/
49-
e_log_lev get_log_level();
49+
e_log_lev get_log_level(void);
5050

5151
/**
5252
* printf回调函数
@@ -63,7 +63,7 @@ void set_printf_ptr(printf_ptr cb);
6363
* 获取printf函数
6464
* @return
6565
*/
66-
printf_ptr get_printf_ptr();
66+
printf_ptr get_printf_ptr(void);
6767

6868

6969
#ifndef ANDROID

src/source/tinybuf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static inline int int_deserialize(const uint8_t *in, int in_size, uint64_t *out)
7272
return index;
7373
}
7474

75-
tinybuf_value *tinybuf_value_alloc(){
75+
tinybuf_value *tinybuf_value_alloc(void){
7676
tinybuf_value *ret = tinybuf_malloc(sizeof(tinybuf_value));
7777
assert(ret);
7878
//置0

src/source/tinybuf_buffer.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static inline int buffer_release(buffer *buf){
3232
return 0;
3333
}
3434

35-
buffer *buffer_alloc(){
35+
buffer *buffer_alloc(void){
3636
buffer *ret = (buffer *) tinybuf_malloc(sizeof(buffer));
3737
assert(ret);
3838
memset(ret,0, sizeof(buffer));;
@@ -161,7 +161,7 @@ int buffer_move(buffer *dst,buffer *src){
161161
return 0;
162162
}
163163

164-
int buffer_length(buffer *buf){
164+
static int buffer_length(buffer *buf){
165165
if(!buf){
166166
return 0;
167167
}

src/source/tinybuf_json.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ static inline int tinybuf_json_load_for_array(const char *ptr, int size, tinybuf
908908
}
909909
}
910910

911-
int scanf_int(const char *str,int str_len,int64_t *out){
911+
static int scanf_int(const char *str,int str_len,int64_t *out){
912912
int is_negtive = 0;
913913
*out = 0;
914914
int i;

src/source/tinybuf_log.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const char *LOG_CONST_TABLE[][3] = {
2323
android_LogPriority LogPriorityArr[] = {ANDROID_LOG_VERBOSE,ANDROID_LOG_DEBUG,ANDROID_LOG_INFO,ANDROID_LOG_WARN,ANDROID_LOG_ERROR};
2424
#endif
2525

26-
void print_time(const struct timeval *tv,char *buf,int buf_size) {
26+
static void print_time(const struct timeval *tv,char *buf,int buf_size) {
2727
time_t sec_tmp = tv->tv_sec;
2828
struct tm *tm = localtime(&sec_tmp);
2929
snprintf(buf,

0 commit comments

Comments
 (0)