IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 18, 2007, 8:46:45 AM (19 years ago)
Author:
eugene
Message:

return NULL if field is not founddvo/dbFields.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/dbCheckStack.c

    r13479 r14287  
    11# include "dvoshell.h"
    22
    3 int dbCheckStack (dbStack *stack, int Nstack, int table, dbField **inFields, int *Nfields) {
     3int dbCheckStack (dbStack *stack, int Nstack, int table, dbField **inFields, int *inNfields) {
    44
    5   int i, j, status, NFIELDS;
     5  int i, j, status, NFIELDS, Nfields;
    66  char *c;
    77  dbField *fields;
    88
    9   NFIELDS = *Nfields + 10;
    10   REALLOCATE (*inFields, dbField, NFIELDS);
    119  fields = *inFields;
     10  Nfields = *inNfields;
     11
     12  NFIELDS = Nfields + 10;
     13  REALLOCATE (fields, dbField, NFIELDS);
    1214
    1315  for (i = 0; i < Nstack; i++) {
     
    2224
    2325      // this must be a field : is it already in the list?
    24       for (j = 0; (j < *Nfields) && strcasecmp (stack[i].name, fields[j].name); j++);
    25       if (j < *Nfields) {
     26      for (j = 0; (j < Nfields) && strcasecmp (stack[i].name, fields[j].name); j++);
     27      if (j < Nfields) {
    2628        stack[i].field = j;
    2729        stack[i].type  = 'F';
     30        stack[i].name  = NULL;
     31        stack[i].Float = 0.0;
    2832        continue;
    2933      }
     
    3135      // this must be a field : is it a valid name?
    3236      if (table == DVO_TABLE_MEASURE) {
    33         status = ParseMeasureField (&fields[*Nfields], stack[i].name);
     37        status = ParseMeasureField (&fields[Nfields], stack[i].name);
    3438      }
    3539      if (table == DVO_TABLE_AVERAGE) {
    36         status = ParseAverageField (&fields[*Nfields], stack[i].name);
     40        status = ParseAverageField (&fields[Nfields], stack[i].name);
    3741      }
    3842      if (!status) {
     
    4044        return (FALSE);
    4145      }
    42       stack[i].field = *Nfields;
     46      stack[i].field = Nfields;
    4347      stack[i].type  = 'F';
     48      stack[i].name  = NULL;
     49      stack[i].Float = 0.0;
    4450
    45       *Nfields ++;
    46       CHECK_REALLOCATE (*inFields, dbField, NFIELDS, *Nfields, 10);
    47       fields = *inFields;
     51      Nfields ++;
     52      CHECK_REALLOCATE (fields, dbField, NFIELDS, Nfields, 10);
    4853    }
    4954  }
     55
     56  *inNfields = Nfields;
     57  *inFields = fields;
     58
    5059  return (TRUE);
    5160}
Note: See TracChangeset for help on using the changeset viewer.