فهرست منبع

core: introduce '+' as PV_INDX_ITR

With this notation we want to check all values one by one not
the list of coma separated values
Victor Seva 10 سال پیش
والد
کامیت
28553798f5
2فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 9 1
      pvapi.c
  2. 1 0
      pvar.h

+ 9 - 1
pvapi.c

@@ -667,6 +667,11 @@ int pv_parse_index(pv_spec_p sp, str *in)
 		sp->pvp.pvi.type = PV_IDX_ALL;
 		return 0;
 	}
+	if(*p=='+' && in->len==1)
+	{
+		sp->pvp.pvi.type = PV_IDX_ITR;
+		return 0;
+	}
 	sign = 1;
 	if(*p=='-')
 	{
@@ -1225,7 +1230,10 @@ int pv_get_spec_index(struct sip_msg* msg, pv_param_p ip, int *idx, int *flags)
 		*flags = PV_IDX_ALL;
 		return 0;
 	}
-	
+	if(ip->pvi.type == PV_IDX_ITR) {
+		*flags = PV_IDX_ITR;
+		return 0;
+	}
 	if(ip->pvi.type == PV_IDX_INT)
 	{
 		*idx = ip->pvi.u.ival;

+ 1 - 0
pvar.h

@@ -60,6 +60,7 @@
 #define PV_IDX_INT	0
 #define PV_IDX_PVAR	1
 #define PV_IDX_ALL	2
+#define PV_IDX_ITR	3
 
 /*! if PV name is dynamic, integer, or str */
 #define pv_has_dname(pv) ((pv)->pvp.pvn.type==PV_NAME_PVAR)