浏览代码

Provide two useful macros for str initialization: STR_STATIC_INIT() and
STR_NULL. Adjust all modules to use those macros where appropriate.

Verified by: md5(1) (those modules, which actually compile)

Maxim Sobolev 20 年之前
父节点
当前提交
c89df7e52c
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1 1
      modules/tm/t_fifo.c
  2. 2 0
      str.h

+ 1 - 1
modules/tm/t_fifo.c

@@ -669,7 +669,7 @@ static int assemble_msg(struct sip_msg* msg, struct tw_info *twi)
 	static char     route_buffer[ROUTE_BUFFER_MAX];
 	static char     append_buf[APPEND_BUFFER_MAX];
 	static char     cmd_buf[CMD_BUFFER_MAX];
-	static str      empty_param = {".",1};
+	static str      empty_param = STR_STATIC_INIT(".");
 	unsigned int      hash_index, label;
 	contact_body_t*   cb=0;
 	contact_t*        c=0;

+ 2 - 0
str.h

@@ -37,5 +37,7 @@ struct _str{
 
 typedef struct _str str;
 
+#define STR_STATIC_INIT(v) {(v), sizeof(v) - 1}
+#define STR_NULL {NULL, 0}
 
 #endif