mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Remove some unused code from ut_util
library
This commit is contained in:
parent
5f6def8b6b
commit
3e374d8c71
@ -94,9 +94,6 @@ ut_init(int argc, char** argv, struct UTOptions * options)
|
||||
case 's': /*slices*/
|
||||
if((stat=parseslices(optarg,&options->nslices,options->slices))) usage(THROW(stat));
|
||||
break;
|
||||
case 'W': /*walk data*/
|
||||
options->idatalen = parseintvector(optarg,4,(void**)&options->idata);
|
||||
break;
|
||||
case '?':
|
||||
fprintf(stderr,"unknown option: '%c'\n",c);
|
||||
stat = NC_EINVAL;
|
||||
|
@ -53,7 +53,6 @@ struct UTOptions {
|
||||
NCZSlice slices[NC_MAX_VAR_DIMS];
|
||||
NClist* dimdefs; /*List<struct Dimdef*> */
|
||||
NClist* vardefs; /*List<struct Vardef*> */
|
||||
size_t idatalen;
|
||||
int* idata;
|
||||
};
|
||||
|
||||
|
@ -199,44 +199,6 @@ parsestringvector(const char* s0, int stopchar, char*** namesp)
|
||||
return nelems;
|
||||
}
|
||||
|
||||
int
|
||||
parseintvector(const char* s0, int typelen, void** vectorp)
|
||||
{
|
||||
int count,nchars,nelems,index;
|
||||
const char* s = NULL;
|
||||
void* vector = NULL;
|
||||
|
||||
/* First, compute number of elements */
|
||||
for(s=s0,nelems=1;*s;s++) {
|
||||
if(*s == ',') nelems++;
|
||||
}
|
||||
|
||||
vector = calloc(nelems,typelen);
|
||||
|
||||
/* Extract the elements of the vector */
|
||||
/* Skip any leading bracketchar */
|
||||
s=s0;
|
||||
if(strchr(OPEN,*s0) != NULL) s++;
|
||||
for(index=0;*s;index++) {
|
||||
long long elem;
|
||||
nchars = -1;
|
||||
count = sscanf(s,"%lld%n",&elem,&nchars);
|
||||
if(nchars == -1 || count != 1) return THROW(NC_EINVAL);
|
||||
s += nchars;
|
||||
if(*s == ',') s++;
|
||||
switch (typelen) {
|
||||
case 1: ((char*)vector)[index] = (char)elem; break;
|
||||
case 2: ((short*)vector)[index] = (short)elem; break;
|
||||
case 4: ((int*)vector)[index] = (int)elem; break;
|
||||
case 8: ((long long*)vector)[index] = (long long)elem; break;
|
||||
default: abort();
|
||||
}
|
||||
}
|
||||
assert(nelems == index);
|
||||
if(vectorp) *vectorp = vector;
|
||||
return nelems;
|
||||
}
|
||||
|
||||
void
|
||||
freedimdefs(NClist* defs)
|
||||
{
|
||||
|
@ -11,7 +11,6 @@ extern int parseslices(const char* s0, int* nslicesp, NCZSlice* slices);
|
||||
extern int parsedimdef(const char* s0, Dimdef** defp);
|
||||
extern int parsevardef(const char* s0, NClist* dimdefs, Vardef** varp);
|
||||
extern int parsestringvector(const char* s0, int stopchar, char*** namesp);
|
||||
extern int parseintvector(const char* s0, int typelen, void** vectorp);
|
||||
extern void freedimdefs(NClist* defs);
|
||||
extern void freevardefs(NClist* defs);
|
||||
extern void freeranges(NCZChunkRange* ranges);
|
||||
|
Loading…
Reference in New Issue
Block a user