[asterisk-commits] nadi: branch nadi/trunk-cm r44790 -
/team/nadi/trunk-cm/include/asterisk/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Oct 10 08:42:56 MST 2006
Author: nadi
Date: Tue Oct 10 10:42:55 2006
New Revision: 44790
URL: http://svn.digium.com/view/asterisk?rev=44790&view=rev
Log:
changed the macros
Modified:
team/nadi/trunk-cm/include/asterisk/configman.h
Modified: team/nadi/trunk-cm/include/asterisk/configman.h
URL: http://svn.digium.com/view/asterisk/team/nadi/trunk-cm/include/asterisk/configman.h?rev=44790&r1=44789&r2=44790&view=diff
==============================================================================
--- team/nadi/trunk-cm/include/asterisk/configman.h (original)
+++ team/nadi/trunk-cm/include/asterisk/configman.h Tue Oct 10 10:42:55 2006
@@ -136,45 +136,39 @@
*/
int cm_get (cm_t *cm, char *buf, size_t size, int sec_id, int elem_id, ...);
-#define cm_get_bool(cm,dest,sec_id,elem_id,...) \
-({ \
- char buf[32]; \
- int retval = 0; \
- if (cm_get((cm), buf, sizeof(buf), (sec_id), (elem_id), ##__VA_ARGS__)) \
- retval = -1; \
- else \
- dest = ast_true(buf) ? 1 : 0; \
- retval; \
-})
-
#define cm_get_int(cm,dest,sec_id,elem_id,...) \
({ \
- char buf[32]; \
- int retval = 0; \
- if (cm_get((cm), buf, sizeof(buf), (sec_id), (elem_id), ##__VA_ARGS__) || \
- sscanf(buf, "%d", &(dest)) != 1) \
- retval = -1; \
- retval; \
+ char __buf[32]; \
+ int __retval = 0, __tmp; \
+ if (cm_get((cm), __buf, sizeof(__buf), (sec_id), (elem_id), ##__VA_ARGS__) || \
+ sscanf(__buf, "%d", &__tmp) != 1) \
+ __retval = -1; \
+ else \
+ dest = __tmp; \
+ __retval; \
})
#define cm_get_boolint(cm,dest,val_true,val_false,sec_id,elem_id,...) \
({ \
- char buf[32]; \
- int retval = 0; \
- if (cm_get((cm), buf, sizeof(buf), (sec_id), (elem_id), ##__VA_ARGS__)) \
- retval = -1; \
- else if (sscanf(buf, "%d", &(dest)) != 1) \
- dest = ast_true(buf) ? val_true : val_false; \
- retval; \
+ char __buf[32]; \
+ int __retval = 0; \
+ if (cm_get((cm), __buf, sizeof(__buf), (sec_id), (elem_id), ##__VA_ARGS__)) \
+ __retval = -1; \
+ else \
+ dest = ast_true(__buf) ? val_true : val_false; \
+ __retval; \
})
+
+#define cm_get_bool(cm,dest,sec_id,elem_id,...) \
+ cm_get_boolint(cm, dest, 1, 0, sec_id, elem_id, ##__VA_ARGS__)
#define cm_get_strcasecmp(cm,str,sec_id,elem_id,...) \
({ \
char __buf[128]; \
- int retval = -1; \
+ int __retval = -1; \
if (!cm_get((cm), __buf, sizeof(__buf), (sec_id), (elem_id), ##__VA_ARGS__)) \
- retval = strcasecmp((str), __buf); \
- retval; \
+ __retval = strcasecmp((str), __buf); \
+ __retval; \
})
#endif
More information about the asterisk-commits
mailing list