Browse code

- added error message when register_avpflag fails - changed avp_flag_t from 16 to 32 bits, avpflags are starting widely used and limitation to max.3 avpflags was too tight

Tomas Mandys authored on 16/03/2007 09:00:52
Showing 2 changed files
... ...
@@ -1093,7 +1093,10 @@ avp_flags_t register_avpflag(char* name) {
1093 1093
 	avp_flags_t ret;
1094 1094
 	ret = get_avpflag_no(name);
1095 1095
 	if (ret == 0) {
1096
-		if (registered_avpflags_no >= MAX_AVPFLAG) return -1;
1096
+		if (registered_avpflags_no >= MAX_AVPFLAG) {
1097
+			LOG(L_ERR, "register_avpflag: cannot register new avp flag ('%s'), max.number of flags (%d) reached\n", name, MAX_AVPFLAG);
1098
+			return -1;
1099
+		}
1097 1100
 		ret = 1<<(AVP_CUSTOM_FLAGS+registered_avpflags_no);
1098 1101
 		registered_avpflags[registered_avpflags_no++] = name;
1099 1102
 	}
... ...
@@ -84,7 +84,7 @@ typedef union {
84 84
 } int_str;
85 85
 
86 86
 #define avp_id_t	unsigned short
87
-#define avp_flags_t	unsigned short
87
+#define avp_flags_t	unsigned int
88 88
 #define avp_name_t	int_str
89 89
 #define avp_value_t	int_str
90 90
 #define avp_index_t	unsigned short