[bwm-tools-devel] COMMIT - r85 - in trunk: bwm_graph include
Brought to you by:
nkukard
From: <sv...@li...> - 2006-03-06 09:36:33
|
Author: nkukard Date: 2006-03-06 09:35:39 +0000 (Mon, 06 Mar 2006) New Revision: 85 Modified: trunk/bwm_graph/graph.h trunk/include/misc.h Log: * Moved argv & argc handling functions to misc.h Modified: trunk/bwm_graph/graph.h =================================================================== --- trunk/bwm_graph/graph.h 2006-03-06 09:30:54 UTC (rev 84) +++ trunk/bwm_graph/graph.h 2006-03-06 09:35:39 UTC (rev 85) @@ -30,31 +30,6 @@ #include "common.h" -// Macro to add a double -a .... parameter to a char ** array -#define ADD_DOUBLE_PARAM(paramList,numParams,param,format,...) \ - { \ - int i; \ - \ - numParams += 2; \ - paramList = (char **) realloc(paramList, numParams * sizeof(char*)); \ - for (i = numParams - 2; i < numParams; i++) \ - paramList[i] = malloc0(BUFFER_SIZE); \ - strcpy(paramList[numParams - 2], param); \ - snprintf(paramList[numParams - 1], BUFFER_SIZE, format, __VA_ARGS__); \ - } - -// Macro to add a single -a parameter to a char ** array -#define ADD_SINGLE_PARAM(paramList,numParams,format,...) \ - { \ - int i; \ - \ - numParams += 1; \ - paramList = (char **) realloc(paramList, numParams * sizeof(char*)); \ - for (i = numParams - 1; i < numParams; i++) \ - paramList[i] = malloc0(BUFFER_SIZE); \ - snprintf(paramList[numParams - 1], BUFFER_SIZE, format, __VA_ARGS__); \ - } - // Macro to decide the correct date and time #define STR_TIME(time_p,buffer_size,buffer) \ { \ Modified: trunk/include/misc.h =================================================================== --- trunk/include/misc.h 2006-03-06 09:30:54 UTC (rev 84) +++ trunk/include/misc.h 2006-03-06 09:35:39 UTC (rev 85) @@ -26,6 +26,32 @@ #define _MISC_H +// Macro to add a double -a .... parameter to a char ** array +#define ADD_DOUBLE_PARAM(paramList,numParams,param,format,...) \ + { \ + int i; \ + \ + numParams += 2; \ + paramList = (char **) realloc(paramList, numParams * sizeof(char*)); \ + for (i = numParams - 2; i < numParams; i++) \ + paramList[i] = malloc0(BUFFER_SIZE); \ + strcpy(paramList[numParams - 2], param); \ + snprintf(paramList[numParams - 1], BUFFER_SIZE, format, __VA_ARGS__); \ + } + +// Macro to add a single -a parameter to a char ** array +#define ADD_SINGLE_PARAM(paramList,numParams,format,...) \ + { \ + int i; \ + \ + numParams += 1; \ + paramList = (char **) realloc(paramList, numParams * sizeof(char*)); \ + for (i = numParams - 1; i < numParams; i++) \ + paramList[i] = malloc0(BUFFER_SIZE); \ + snprintf(paramList[numParams - 1], BUFFER_SIZE, format, __VA_ARGS__); \ + } + + // Convert everything between start & end into an integer int aptrtoi(char *start, char *end); |