Browse Source

- 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 18 years ago
parent
commit
cead8fc39c
2 changed files with 5 additions and 2 deletions
  1. 4 1
      usr_avp.c
  2. 1 1
      usr_avp.h

+ 4 - 1
usr_avp.c

@@ -1093,7 +1093,10 @@ avp_flags_t register_avpflag(char* name) {
 	avp_flags_t ret;
 	ret = get_avpflag_no(name);
 	if (ret == 0) {
-		if (registered_avpflags_no >= MAX_AVPFLAG) return -1;
+		if (registered_avpflags_no >= MAX_AVPFLAG) {
+			LOG(L_ERR, "register_avpflag: cannot register new avp flag ('%s'), max.number of flags (%d) reached\n", name, MAX_AVPFLAG);
+			return -1;
+		}
 		ret = 1<<(AVP_CUSTOM_FLAGS+registered_avpflags_no);
 		registered_avpflags[registered_avpflags_no++] = name;
 	}

+ 1 - 1
usr_avp.h

@@ -84,7 +84,7 @@ typedef union {
 } int_str;
 
 #define avp_id_t	unsigned short
-#define avp_flags_t	unsigned short
+#define avp_flags_t	unsigned int
 #define avp_name_t	int_str
 #define avp_value_t	int_str
 #define avp_index_t	unsigned short