Deleted Added
full compact
configfile.c (285169) configfile.c (294554)
1/**
2 * \file configfile.c
3 *
4 * configuration/rc/ini file handling.
5 *
6 * @addtogroup autoopts
7 * @{
8 */

--- 168 unchanged lines hidden (view full) ---

177 errno = EINVAL;
178 }
179
180 else if (odesc->optCookie == NULL) {
181 errno = ENOENT;
182 }
183
184 else do {
1/**
2 * \file configfile.c
3 *
4 * configuration/rc/ini file handling.
5 *
6 * @addtogroup autoopts
7 * @{
8 */

--- 168 unchanged lines hidden (view full) ---

177 errno = EINVAL;
178 }
179
180 else if (odesc->optCookie == NULL) {
181 errno = ENOENT;
182 }
183
184 else do {
185 tArgList * argl = odesc->optCookie;
186 int argct = argl->useCt;
187 void ** poptv = (void **)(argl->apzArgs);
185 tArgList * argl = odesc->optCookie;
186 int argct = argl->useCt;
187 const void ** poptv = VOIDP(argl->apzArgs);
188
189 if (argct == 0) {
190 errno = ENOENT;
191 break;
192 }
193
194 if (name == NULL) {
188
189 if (argct == 0) {
190 errno = ENOENT;
191 break;
192 }
193
194 if (name == NULL) {
195 res = (tOptionValue *)*poptv;
195 res = (const tOptionValue *)*poptv;
196 break;
197 }
198
199 while (--argct >= 0) {
200 const tOptionValue * ov = *(poptv++);
201 const tOptionValue * rv = optionGetValue(ov, name);
202
203 if (rv == NULL)

--- 40 unchanged lines hidden (view full) ---

244 * @code{ENOENT} - no entry matched the given name.
245 * @end itemize
246=*/
247tOptionValue const *
248optionFindNextValue(const tOptDesc * odesc, const tOptionValue * pPrevVal,
249 char const * pzName, char const * pzVal)
250{
251 bool old_found = false;
196 break;
197 }
198
199 while (--argct >= 0) {
200 const tOptionValue * ov = *(poptv++);
201 const tOptionValue * rv = optionGetValue(ov, name);
202
203 if (rv == NULL)

--- 40 unchanged lines hidden (view full) ---

244 * @code{ENOENT} - no entry matched the given name.
245 * @end itemize
246=*/
247tOptionValue const *
248optionFindNextValue(const tOptDesc * odesc, const tOptionValue * pPrevVal,
249 char const * pzName, char const * pzVal)
250{
251 bool old_found = false;
252 tOptionValue * res = NULL;
252 const tOptionValue * res = NULL;
253
254 (void)pzName;
255 (void)pzVal;
256
257 if ( (odesc == NULL)
258 || (OPTST_GET_ARGTYPE(odesc->fOptState) != OPARG_TYPE_HIERARCHY)) {
259 errno = EINVAL;
260 }
261
262 else if (odesc->optCookie == NULL) {
263 errno = ENOENT;
264 }
265
266 else do {
253
254 (void)pzName;
255 (void)pzVal;
256
257 if ( (odesc == NULL)
258 || (OPTST_GET_ARGTYPE(odesc->fOptState) != OPARG_TYPE_HIERARCHY)) {
259 errno = EINVAL;
260 }
261
262 else if (odesc->optCookie == NULL) {
263 errno = ENOENT;
264 }
265
266 else do {
267 tArgList * argl = odesc->optCookie;
268 int ct = argl->useCt;
269 void ** poptv = (void **)argl->apzArgs;
267 tArgList * argl = odesc->optCookie;
268 int ct = argl->useCt;
269 const void ** poptv = VOIDP(argl->apzArgs);
270
271 while (--ct >= 0) {
270
271 while (--ct >= 0) {
272 tOptionValue * pOV = *(poptv++);
272 const tOptionValue * pOV = *(poptv++);
273 if (old_found) {
274 res = pOV;
275 break;
276 }
277 if (pOV == pPrevVal)
278 old_found = true;
279 }
280 if (res == NULL)

--- 29 unchanged lines hidden (view full) ---

310 * hierarchical option value.
311 * @item
312 * @code{ENOENT} - no entry matched the given name.
313 * @end itemize
314=*/
315tOptionValue const *
316optionGetValue(tOptionValue const * oov, char const * vname)
317{
273 if (old_found) {
274 res = pOV;
275 break;
276 }
277 if (pOV == pPrevVal)
278 old_found = true;
279 }
280 if (res == NULL)

--- 29 unchanged lines hidden (view full) ---

310 * hierarchical option value.
311 * @item
312 * @code{ENOENT} - no entry matched the given name.
313 * @end itemize
314=*/
315tOptionValue const *
316optionGetValue(tOptionValue const * oov, char const * vname)
317{
318 tArgList * arg_list;
319 tOptionValue * res = NULL;
318 tArgList * arg_list;
319 const tOptionValue * res = NULL;
320
321 if ((oov == NULL) || (oov->valType != OPARG_TYPE_HIERARCHY)) {
322 errno = EINVAL;
323 return res;
324 }
325 arg_list = oov->v.nestVal;
326
327 if (arg_list->useCt > 0) {
320
321 if ((oov == NULL) || (oov->valType != OPARG_TYPE_HIERARCHY)) {
322 errno = EINVAL;
323 return res;
324 }
325 arg_list = oov->v.nestVal;
326
327 if (arg_list->useCt > 0) {
328 int ct = arg_list->useCt;
329 void ** ovlist = (void **)(arg_list->apzArgs);
328 int ct = arg_list->useCt;
329 const void ** ovlist = VOIDP(arg_list->apzArgs);
330
331 if (vname == NULL) {
330
331 if (vname == NULL) {
332 res = (tOptionValue *)*ovlist;
332 res = (const tOptionValue *)*ovlist;
333
334 } else do {
333
334 } else do {
335 tOptionValue * opt_val = *(ovlist++);
335 const tOptionValue * opt_val = *(ovlist++);
336 if (strcmp(opt_val->pzName, vname) == 0) {
337 res = opt_val;
338 break;
339 }
340 } while (--ct > 0);
341 }
342 if (res == NULL)
343 errno = ENOENT;

--- 25 unchanged lines hidden (view full) ---

369 * member of that option value.
370 * @item
371 * @code{ENOENT} - the supplied @code{pOldValue} pointed to the last entry.
372 * @end itemize
373=*/
374tOptionValue const *
375optionNextValue(tOptionValue const * ov_list,tOptionValue const * oov )
376{
336 if (strcmp(opt_val->pzName, vname) == 0) {
337 res = opt_val;
338 break;
339 }
340 } while (--ct > 0);
341 }
342 if (res == NULL)
343 errno = ENOENT;

--- 25 unchanged lines hidden (view full) ---

369 * member of that option value.
370 * @item
371 * @code{ENOENT} - the supplied @code{pOldValue} pointed to the last entry.
372 * @end itemize
373=*/
374tOptionValue const *
375optionNextValue(tOptionValue const * ov_list,tOptionValue const * oov )
376{
377 tArgList * arg_list;
378 tOptionValue * res = NULL;
379 int err = EINVAL;
377 tArgList * arg_list;
378 const tOptionValue * res = NULL;
379 int err = EINVAL;
380
381 if ((ov_list == NULL) || (ov_list->valType != OPARG_TYPE_HIERARCHY)) {
382 errno = EINVAL;
383 return NULL;
384 }
385 arg_list = ov_list->v.nestVal;
386 {
380
381 if ((ov_list == NULL) || (ov_list->valType != OPARG_TYPE_HIERARCHY)) {
382 errno = EINVAL;
383 return NULL;
384 }
385 arg_list = ov_list->v.nestVal;
386 {
387 int ct = arg_list->useCt;
388 void ** o_list = (void **)(arg_list->apzArgs);
387 int ct = arg_list->useCt;
388 const void ** o_list = VOIDP(arg_list->apzArgs);
389
390 while (ct-- > 0) {
389
390 while (ct-- > 0) {
391 tOptionValue * nov = *(o_list++);
391 const tOptionValue * nov = *(o_list++);
392 if (nov == oov) {
393 if (ct == 0) {
394 err = ENOENT;
395
396 } else {
397 err = 0;
392 if (nov == oov) {
393 if (ct == 0) {
394 err = ENOENT;
395
396 } else {
397 err = 0;
398 res = (tOptionValue *)*o_list;
398 res = (const tOptionValue *)*o_list;
399 }
400 break;
401 }
402 }
403 }
404 if (err != 0)
405 errno = err;
406 return res;

--- 975 unchanged lines hidden ---
399 }
400 break;
401 }
402 }
403 }
404 if (err != 0)
405 errno = err;
406 return res;

--- 975 unchanged lines hidden ---