Remove some unused code from ut_util library

This commit is contained in:
Peter Hill 2023-11-30 14:07:07 +00:00
parent 5f6def8b6b
commit 3e374d8c71
No known key found for this signature in database
GPG Key ID: 0C6B9742E72848EE
4 changed files with 0 additions and 43 deletions

View File

@ -94,9 +94,6 @@ ut_init(int argc, char** argv, struct UTOptions * options)
case 's': /*slices*/ case 's': /*slices*/
if((stat=parseslices(optarg,&options->nslices,options->slices))) usage(THROW(stat)); if((stat=parseslices(optarg,&options->nslices,options->slices))) usage(THROW(stat));
break; break;
case 'W': /*walk data*/
options->idatalen = parseintvector(optarg,4,(void**)&options->idata);
break;
case '?': case '?':
fprintf(stderr,"unknown option: '%c'\n",c); fprintf(stderr,"unknown option: '%c'\n",c);
stat = NC_EINVAL; stat = NC_EINVAL;

View File

@ -53,7 +53,6 @@ struct UTOptions {
NCZSlice slices[NC_MAX_VAR_DIMS]; NCZSlice slices[NC_MAX_VAR_DIMS];
NClist* dimdefs; /*List<struct Dimdef*> */ NClist* dimdefs; /*List<struct Dimdef*> */
NClist* vardefs; /*List<struct Vardef*> */ NClist* vardefs; /*List<struct Vardef*> */
size_t idatalen;
int* idata; int* idata;
}; };

View File

@ -199,44 +199,6 @@ parsestringvector(const char* s0, int stopchar, char*** namesp)
return nelems; 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 void
freedimdefs(NClist* defs) freedimdefs(NClist* defs)
{ {

View File

@ -11,7 +11,6 @@ extern int parseslices(const char* s0, int* nslicesp, NCZSlice* slices);
extern int parsedimdef(const char* s0, Dimdef** defp); extern int parsedimdef(const char* s0, Dimdef** defp);
extern int parsevardef(const char* s0, NClist* dimdefs, Vardef** varp); extern int parsevardef(const char* s0, NClist* dimdefs, Vardef** varp);
extern int parsestringvector(const char* s0, int stopchar, char*** namesp); 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 freedimdefs(NClist* defs);
extern void freevardefs(NClist* defs); extern void freevardefs(NClist* defs);
extern void freeranges(NCZChunkRange* ranges); extern void freeranges(NCZChunkRange* ranges);