Example #1
0
void poptResetContext(poptContext con) {
    int i;

    while (con->os > con->optionStack) {
	cleanOSE(con->os--);
    }
    if (con->os->argb) {
	PBM_FREE(con->os->argb);
	con->os->argb = NULL;
    }
    con->os->currAlias = NULL;
    con->os->nextCharArg = NULL;
    con->os->nextArg = NULL;
    con->os->next = 1;			/* skip argv[0] */

    con->numLeftovers = 0;
    con->nextLeftover = 0;
    con->restLeftover = 0;
    con->doExec = NULL;

    for (i = 0; i < con->finalArgvCount; i++) {
	if (con->finalArgv[i]) {
	    xfree(con->finalArgv[i]);
	    con->finalArgv[i] = NULL;
	}
    }

    con->finalArgvCount = 0;

    if (con->arg_strip) {
	PBM_FREE(con->arg_strip);
	con->arg_strip = NULL;
    }
}
Example #2
0
/*@-boundswrite@*/
void poptResetContext(poptContext con)
{
    int i;

    if (con == NULL) return;
    while (con->os > con->optionStack) {
	cleanOSE(con->os--);
    }
    con->os->argb = (pbm_set *)PBM_FREE(con->os->argb);
    con->os->currAlias = NULL;
    con->os->nextCharArg = NULL;
    con->os->nextArg = NULL;
    con->os->next = 1;			/* skip argv[0] */

    con->numLeftovers = 0;
    con->nextLeftover = 0;
    con->restLeftover = 0;
    con->doExec = NULL;

    if (con->finalArgv != NULL)
    for (i = 0; i < con->finalArgvCount; i++) {
	/*@-unqualifiedtrans@*/		/* FIX: typedef double indirection. */
	con->finalArgv[i] = (const char *)_free(con->finalArgv[i]);
	/*@=unqualifiedtrans@*/
    }

    con->finalArgvCount = 0;
    con->arg_strip = ( pbm_set *)PBM_FREE(con->arg_strip);
    /*@-nullstate@*/	/* FIX: con->finalArgv != NULL */
    return;
    /*@=nullstate@*/
}
Example #3
0
/*@-mustmod@*/	/* XXX splint on crack */
static void rpmbfFini(void * _bf)
	/*@globals fileSystem @*/
	/*@modifies *_bf, fileSystem @*/
{
    rpmbf bf = (rpmbf) _bf;

    bf->bits = PBM_FREE(bf->bits);
}
Example #4
0
static void cleanOSE(/*@special@*/ struct optionStackEntry *os)
	/*@uses os @*/
	/*@releases os->nextArg, os->argv, os->argb @*/
	/*@modifies os @*/
{
    os->nextArg = (const char *)_free(os->nextArg);
    os->argv = (const char **)_free(os->argv);
    os->argb = (pbm_set *)PBM_FREE(os->argb);
}
Example #5
0
File: popt.c Project: OPSF/uClinux
static void cleanOSE(/*@special@*/ struct optionStackEntry *os)
	/*@uses os @*/
	/*@releases os->nextArg, os->argv, os->argb @*/
	/*@modifies os @*/
{
    os->nextArg = _free(os->nextArg);
    os->argv = _free(os->argv);
    os->argb = PBM_FREE(os->argb);
}
Example #6
0
static void cleanOSE(struct optionStackEntry *os)
{
    if (os->nextArg) {
	xfree(os->nextArg);
	os->nextArg = NULL;
    }
    if (os->argv) {
	xfree(os->argv);
	os->argv = NULL;
    }
    if (os->argb) {
	PBM_FREE(os->argb);
	os->argb = NULL;
    }
}
Example #7
0
poptContext poptFreeContext(poptContext con)
{
    poptItem item;
    int i;

    if (con == NULL) return con;
    poptResetContext(con);
    con->os->argb = (pbm_set *)_free(con->os->argb);

    if (con->aliases != NULL)
    for (i = 0; i < con->numAliases; i++) {
	item = con->aliases + i;
	/*@-modobserver -observertrans -dependenttrans@*/
	item->option.longName = (const char *)_free(item->option.longName);
	item->option.descrip = (const char *)_free(item->option.descrip);
	item->option.argDescrip = (const char *)_free(item->option.argDescrip);
	/*@=modobserver =observertrans =dependenttrans@*/
	item->argv = (const char **)_free(item->argv);
    }
    con->aliases = (poptItem)_free(con->aliases);

    if (con->execs != NULL)
    for (i = 0; i < con->numExecs; i++) {
	item = con->execs + i;
	/*@-modobserver -observertrans -dependenttrans@*/
	item->option.longName = (const char *)_free(item->option.longName);
	item->option.descrip = (const char *)_free(item->option.descrip);
	item->option.argDescrip = (const char *)_free(item->option.argDescrip);
	/*@=modobserver =observertrans =dependenttrans@*/
	item->argv = (const char **)_free(item->argv);
    }
    con->execs = (poptItem)_free(con->execs);

    con->leftovers = (const char **)_free(con->leftovers);
    con->finalArgv = (const char **)_free(con->finalArgv);
    con->appName = (const char *)_free(con->appName);
    con->otherHelp = (const char *)_free(con->otherHelp);
    con->execPath = (const char *)_free(con->execPath);
    con->arg_strip = (pbm_set *)PBM_FREE(con->arg_strip);
    
    con = (poptContext)_free(con);
    return con;
}