summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--popt.c58
-rw-r--r--poptconfig.c18
-rw-r--r--popthelp.c40
-rw-r--r--poptint.c8
4 files changed, 62 insertions, 62 deletions
diff --git a/popt.c b/popt.c
index 30186f0..10ce955 100644
--- a/popt.c
+++ b/popt.c
@@ -173,7 +173,7 @@ static void invokeCallbacksOPTION(poptContext con,
poptContext poptGetContext(const char * name, int argc, const char ** argv,
const struct poptOption * options, unsigned int flags)
{
- poptContext con = xcalloc(1, sizeof(*con));
+ poptContext con = (poptContext) xcalloc(1, sizeof(*con));
assert(con); /* XXX can't happen */
if (con == NULL) return NULL;
@@ -195,7 +195,7 @@ assert(con); /* XXX can't happen */
if (!(flags & POPT_CONTEXT_KEEP_FIRST))
con->os->next = 1; /* skip argv[0] */
- con->leftovers = xcalloc( (size_t)(argc + 1), sizeof(*con->leftovers) );
+ con->leftovers = (poptArgv) xcalloc( (size_t)(argc + 1), sizeof(*con->leftovers) );
/*@-dependenttrans -assignexpose@*/ /* FIX: W2DO? */
con->options = options;
@@ -209,7 +209,7 @@ assert(con); /* XXX can't happen */
con->numExecs = 0;
con->nav = argc * 2;
- con->av = xcalloc( (size_t)con->nav, sizeof(*con->av) );
+ con->av = (poptArgv) xcalloc( (size_t)con->nav, sizeof(*con->av) );
con->execAbsolute = 1;
con->arg_strip = NULL;
@@ -304,13 +304,13 @@ static int handleExec(/*@special@*/ poptContext con,
time 'round */
if ((con->ac + 1) >= (con->nav)) {
con->nav += 10;
- con->av = xrealloc(con->av, sizeof(*con->av) * con->nav);
+ con->av = (poptArgv) xrealloc(con->av, sizeof(*con->av) * con->nav);
}
i = con->ac++;
assert(con->av); /* XXX can't happen */
if (con->av != NULL)
- { char *s = xmalloc((longName ? strlen(longName) : 0) + sizeof("--"));
+ { char *s = (char*) xmalloc((longName ? strlen(longName) : 0) + sizeof("--"));
assert(s); /* XXX can't happen */
if (s != NULL) {
con->av[i] = s;
@@ -419,9 +419,9 @@ static int handleAlias(/*@special@*/ poptContext con,
con->os->currAlias = con->aliases + i;
{ const char ** av;
int ac = con->os->currAlias->argc;
- /* Append --foo=bar arg to alias argv array (if present). */
+ /* Append --foo=bar arg to alias argv array (if present). */
if (longName && nextArg != NULL && *nextArg != '\0') {
- av = xmalloc((ac + 1 + 1) * sizeof(*av));
+ av = (const char**) xmalloc((ac + 1 + 1) * sizeof(*av));
assert(av); /* XXX won't happen. */
if (av != NULL) {
for (i = 0; i < ac; i++) {
@@ -466,7 +466,7 @@ assert(argv0); /* XXX can't happen */
return NULL;
/* The return buffer in t is big enough for any path. */
- if ((t = xmalloc(strlen(path) + strlen(argv0) + sizeof("/"))) != NULL)
+ if ((t = (char*) xmalloc(strlen(path) + strlen(argv0) + sizeof("/"))) != NULL)
for (s = path; s && *s; s = se) {
/* Snip PATH element into [s,se). */
@@ -511,13 +511,13 @@ assert(item); /*XXX can't happen*/
(!con->execAbsolute && strchr(item->argv[0], '/')))
return POPT_ERROR_NOARG;
- argv = xmalloc(sizeof(*argv) *
+ argv = (poptArgv) xmalloc(sizeof(*argv) *
(6 + item->argc + con->numLeftovers + con->ac));
assert(argv); /* XXX can't happen */
if (argv == NULL) return POPT_ERROR_MALLOC;
if (!strchr(item->argv[0], '/') && con->execPath != NULL) {
- char *s = xmalloc(strlen(con->execPath) + strlen(item->argv[0]) + sizeof("/"));
+ char *s = (char*) xmalloc(strlen(con->execPath) + strlen(item->argv[0]) + sizeof("/"));
if (s)
(void)stpcpy(stpcpy(stpcpy(s, con->execPath), "/"), item->argv[0]);
@@ -715,9 +715,9 @@ expandNextArg(/*@special@*/ poptContext con, const char * s)
size_t tn = strlen(s) + 1;
char c;
- te = t = xmalloc(tn);
+ te = t = (char*) xmalloc(tn);
assert(t); /* XXX can't happen */
- if (t == NULL) return NULL;
+ if (t == NULL) return NULL;
*t = '\0';
while ((c = *s++) != '\0') {
switch (c) {
@@ -738,7 +738,7 @@ assert(t); /* XXX can't happen */
tn += strlen(a);
{ size_t pos = (size_t) (te - t);
- t = xrealloc(t, tn);
+ t = (char*) xrealloc(t, tn);
assert(t); /* XXX can't happen */
if (t == NULL)
return NULL;
@@ -755,7 +755,7 @@ assert(t); /* XXX can't happen */
/* If the new string is longer than needed, shorten. */
if ((t + tn) > te) {
/*@-usereleased@*/ /* XXX splint can't follow the pointers. */
- if ((te = xrealloc(t, (size_t)(te - t))) == NULL)
+ if ((te = (char*) xrealloc(t, (size_t)(te - t))) == NULL)
free(t);
t = te;
/*@=usereleased@*/
@@ -953,7 +953,7 @@ int poptSaveBits(poptBits * bitsp,
/* Parse comma separated attributes. */
te = tbuf = xstrdup(s);
- assert(te);
+ assert(te);
while ((t = te) != NULL && *t) {
while (*te != '\0' && *te != ',')
te++;
@@ -989,9 +989,9 @@ int poptSaveString(const char *** argvp,
if (*argvp != NULL)
while ((*argvp)[argc] != NULL)
argc++;
-
+
/*@-unqualifiedtrans -nullstate@*/ /* XXX no annotation for (*argvp) */
- if ((*argvp = xrealloc(*argvp, (argc + 1 + 1) * sizeof(**argvp))) != NULL) {
+ if ((*argvp = (const char**) xrealloc(*argvp, (argc + 1 + 1) * sizeof(**argvp))) != NULL) {
(*argvp)[argc++] = xstrdup(val);
(*argvp)[argc ] = NULL;
}
@@ -1008,10 +1008,10 @@ static long long poptCalculator(long long arg0, unsigned argInfo, long long arg1
/*@null@*/ const char * expr, int * rcp)
{
int ixmax = 20; /* XXX overkill */
-poptStack_t stk = memset(alloca(ixmax*sizeof(*stk)), 0, (ixmax*sizeof(*stk)));
+poptStack_t stk = (poptStack_t) memset((poptStack_t)alloca(ixmax*sizeof(*stk)), 0, (ixmax*sizeof(*stk)));
int ix = 0;
size_t nt = 64; /* XXX overkill */
-char * t = alloca(nt);
+char * t = (char*) alloca(nt);
char * te = t;
const char * s;
int rc = 0; /* assume success */
@@ -1623,7 +1623,7 @@ assert(opt != NULL); /* XXX can't happen */
if (con->os == con->optionStack
&& F_ISSET(opt, STRIP) && canstrip)
poptStripArg(con, con->os->next);
-
+
assert(con->os->argv); /* XXX can't happen */
if (con->os->argv != NULL) {
if (F_ISSET(opt, OPTIONAL) &&
@@ -1651,14 +1651,14 @@ assert(con->os->argv); /* XXX can't happen */
if ((con->ac + 2) >= (con->nav)) {
con->nav += 10;
- con->av = xrealloc(con->av,
+ con->av = (poptArgv) xrealloc(con->av,
sizeof(*con->av) * con->nav);
}
assert(con->av);
if (con->av) {
size_t nb = (opt->longName ? strlen(opt->longName) : 0) + sizeof("--");
- char *s = xmalloc(nb);
+ char *s = (char*) xmalloc(nb);
assert(s); /* XXX can't happen */
if (s != NULL) {
con->av[con->ac++] = s;
@@ -1770,7 +1770,7 @@ poptContext poptFreeContext(poptContext con)
con->otherHelp = _free(con->otherHelp);
con->execPath = _free(con->execPath);
con->arg_strip = PBM_FREE(con->arg_strip);
-
+
con = _free(con);
return con;
}
@@ -1797,18 +1797,18 @@ int poptAddItem(poptContext con, poptItem newItem, int flags)
{
poptItem * items, item;
size_t * nitems;
- int * naliases;
+ int * naliases;
switch (flags) {
case 1:
items = &con->execs;
nitems = &con->numExecs;
- *items = xrealloc((*items), ((*nitems) + 1) * sizeof(**items));
+ *items = (poptItem) xrealloc((*items), ((*nitems) + 1) * sizeof(**items));
break;
case 0:
items = &con->aliases;
naliases = &con->numAliases;
- *items = xrealloc((*items), ((*naliases) + 1) * sizeof(**items));
+ *items = (poptItem) xrealloc((*items), ((*naliases) + 1) * sizeof(**items));
break;
default:
return 1;
@@ -1918,14 +1918,14 @@ int poptStrippedArgv(poptContext con, int argc, char ** argv)
int numargs = argc;
int j = 1;
int i;
-
+
/*@-sizeoftype@*/
if (con->arg_strip)
for (i = 1; i < argc; i++) {
if (PBM_ISSET(i, con->arg_strip))
numargs--;
}
-
+
for (i = 1; i < argc; i++) {
if (con->arg_strip && PBM_ISSET(i, con->arg_strip))
continue;
@@ -1933,6 +1933,6 @@ int poptStrippedArgv(poptContext con, int argc, char ** argv)
j++;
}
/*@=sizeoftype@*/
-
+
return numargs;
}
diff --git a/poptconfig.c b/poptconfig.c
index 5b286c7..e4446bb 100644
--- a/poptconfig.c
+++ b/poptconfig.c
@@ -3,7 +3,7 @@
*/
/* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
+ file accompanying popt source distributions, available from
ftp://ftp.rpm.org/pub/rpm/dist. */
#include "system.h"
@@ -129,7 +129,7 @@ static int poptGlob(/*@unused@*/ UNUSED(poptContext con), const char * pattern,
{
if (acp)
*acp = 1;
- if (avp && (*avp = calloc((size_t)(1 + 1), sizeof (**avp))) != NULL)
+ if (avp && (*avp = (const char**) calloc((size_t)(1 + 1), sizeof (**avp))) != NULL)
(*avp)[0] = xstrdup(pat);
}
@@ -170,7 +170,7 @@ int poptReadFile(const char * fn, char ** bp, size_t * nbp, int flags)
if ((nb = lseek(fdno, 0, SEEK_END)) == (off_t)-1
|| lseek(fdno, 0, SEEK_SET) == (off_t)-1
- || (b = calloc(sizeof(*b), (size_t)nb + 1)) == NULL
+ || (b = (char*) calloc(sizeof(*b), (size_t)nb + 1)) == NULL
|| read(fdno, (char *)b, (size_t)nb) != (ssize_t)nb)
{
int oerrno = errno;
@@ -275,7 +275,7 @@ static int poptConfigLine(poptContext con, char * line)
if (con->appName == NULL)
goto exit;
-
+
memset(item, 0, sizeof(*item));
appName = se;
@@ -319,7 +319,7 @@ static int poptConfigLine(poptContext con, char * line)
/* Append remaining text to the interpolated file option text. */
if (*se != '\0') {
size_t nse = strlen(se) + 1;
- if ((b = realloc(b, (nb + nse))) == NULL) /* XXX can't happen */
+ if ((b = (char*) realloc(b, (nb + nse))) == NULL) /* XXX can't happen */
goto exit;
(void) stpcpy( stpcpy(&b[nb-1], " "), se);
nb += nse;
@@ -372,7 +372,7 @@ static int poptConfigLine(poptContext con, char * line)
item->argc = j;
}
/*@=modobserver@*/
-
+
/*@-nullstate@*/ /* FIX: item->argv[] may be NULL */
if (!strcmp(entryType, "alias"))
rc = poptAddItem(con, item, 0);
@@ -399,7 +399,7 @@ int poptReadConfigFile(poptContext con, const char * fn)
if (b == NULL || nb == 0)
return POPT_ERROR_BADCONFIG;
- if ((t = malloc(nb + 1)) == NULL)
+ if ((t = (char*) malloc(nb + 1)) == NULL)
goto exit;
te = t;
@@ -533,7 +533,7 @@ int poptReadDefaultConfig(poptContext con, /*@unused@*/ UNUSED(int useEnv))
#endif
if ((home = getenv("HOME"))) {
- char * fn = malloc(strlen(home) + 20);
+ char * fn = (char*) malloc(strlen(home) + 20);
if (fn != NULL) {
(void) stpcpy(stpcpy(fn, home), "/.popt");
rc = poptReadConfigFile(con, fn);
@@ -565,7 +565,7 @@ poptInit(int argc, const char ** argv,
if ((argv0 = strrchr(argv[0], '/')) != NULL) argv0++;
else argv0 = argv[0];
-
+
con = poptGetContext(argv0, argc, (const char **)argv, options, 0);
if (con != NULL&& poptReadConfigFiles(con, configPaths))
con = poptFini(con);
diff --git a/popthelp.c b/popthelp.c
index d990343..36d8b61 100644
--- a/popthelp.c
+++ b/popthelp.c
@@ -5,7 +5,7 @@
*/
/* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
+ file accompanying popt source distributions, available from
ftp://ftp.rpm.org/pub/rpm/dist. */
#include "system.h"
@@ -41,7 +41,7 @@
/*@exits@*/
static void displayArgs(poptContext con,
/*@unused@*/ UNUSED(enum poptCallbackReason foo),
- struct poptOption * key,
+ struct poptOption * key,
/*@unused@*/ UNUSED(const char * arg),
/*@unused@*/ UNUSED(void * data))
/*@globals fileSystem@*/
@@ -110,14 +110,14 @@ typedef struct columns_s {
size_t max;
} * columns_t;
-/**
+/**
* Return no. of columns in output window.
* @param fp FILE
- * @return no. of columns
- */
+ * @return no. of columns
+ */
static size_t maxColumnWidth(FILE *fp)
/*@*/
-{
+{
size_t maxcols = _POPTHELP_MAXLINE;
#if defined(TIOCGWINSZ)
struct winsize ws;
@@ -131,7 +131,7 @@ static size_t maxColumnWidth(FILE *fp)
}
#endif
return maxcols;
-}
+}
/**
* Determine number of display characters in a string.
@@ -238,7 +238,7 @@ singleOptionDefaultValue(size_t lineLength,
/*@*/
{
const char * defstr = D_(translation_domain, "default");
- char * le = xmalloc(4*lineLength + 1);
+ char * le = (char*) xmalloc(4*lineLength + 1);
char * l = le;
assert(le); /* XXX can't happen */
@@ -336,7 +336,7 @@ static void singleOptionHelp(FILE * fp, columns_t columns,
if (F_ISSET(opt, TOGGLE)) nb += sizeof("[no]") - 1;
if (argDescrip) nb += strlen(argDescrip);
- left = xmalloc(nb);
+ left = (char*) xmalloc(nb);
assert(left); /* XXX can't happen */
if (left == NULL) return;
left[0] = '\0';
@@ -383,7 +383,7 @@ assert(left); /* XXX can't happen */
if (F_ISSET(opt, SHOW_DEFAULT)) {
defs = singleOptionDefaultValue(lineLength, opt, translation_domain);
if (defs) {
- char * t = xmalloc((help ? strlen(help) : 0) +
+ char * t = (char*) xmalloc((help ? strlen(help) : 0) +
strlen(defs) + sizeof(" "));
assert(t); /* XXX can't happen */
if (t) {
@@ -467,7 +467,7 @@ assert(t); /* XXX can't happen */
if (help)
xx = POPT_fprintf(fp," %-*s ", (int)(maxLeftCol+displaypad), left);
else {
- xx = POPT_fprintf(fp," %s\n", left);
+ xx = POPT_fprintf(fp," %s\n", left);
goto out;
}
@@ -531,7 +531,7 @@ static size_t maxArgWidth(const struct poptOption * opt,
{
size_t max = 0;
const char * argDescrip;
-
+
if (opt != NULL)
while (opt->longName || opt->shortName || opt->arg) {
size_t len = 0;
@@ -564,7 +564,7 @@ static size_t maxArgWidth(const struct poptOption * opt,
}
opt++;
}
-
+
return max;
}
@@ -633,7 +633,7 @@ static void singleTableHelp(poptContext con, FILE * fp,
sub_transdom = getTableTranslationDomain(opt->arg);
if (sub_transdom == NULL)
sub_transdom = translation_domain;
-
+
/* If no popt aliases/execs, skip poptAliasOption processing. */
if (opt->arg == poptAliasOptions && !(con->numAliases || con->numExecs))
continue;
@@ -675,7 +675,7 @@ static size_t showHelpIntro(poptContext con, FILE * fp)
void poptPrintHelp(poptContext con, FILE * fp, /*@unused@*/ UNUSED(int flags))
{
- columns_t columns = xcalloc((size_t)1, sizeof(*columns));
+ columns_t columns = (columns_t) xcalloc((size_t)1, sizeof(*columns));
int xx;
assert(columns); /* XXX can't happen */
@@ -736,7 +736,7 @@ static size_t singleOptionUsage(FILE * fp, columns_t columns,
if ((columns->cur + len) > columns->max) {
fprintf(fp, "\n ");
columns->cur = (size_t)7;
- }
+ }
fprintf(fp, " [");
if (prtshort)
@@ -865,7 +865,7 @@ static size_t showShortOptions(const struct poptOption * opt, FILE * fp,
{
/* bufsize larger then the ascii set, lazy allocation on top level call. */
size_t nb = (size_t)300;
- char * s = (str != NULL ? str : calloc((size_t)1, nb));
+ char * s = (str != NULL ? str : (char*) calloc((size_t)1, nb));
size_t len = (size_t)0;
assert(s); /* XXX can't happen */
@@ -883,7 +883,7 @@ assert(s); /* XXX can't happen */
} else if (poptArgType(opt) == POPT_ARG_INCLUDE_TABLE)
if (opt->arg) /* XXX program error */
len = showShortOptions(opt->arg, fp, s);
- }
+ }
/* On return to top level, print the short options, return print length. */
if (s != str && *s != '\0') {
@@ -899,7 +899,7 @@ assert(s); /* XXX can't happen */
void poptPrintUsage(poptContext con, FILE * fp, /*@unused@*/ UNUSED(int flags))
{
- columns_t columns = xcalloc((size_t)1, sizeof(*columns));
+ columns_t columns = (columns_t) xcalloc((size_t)1, sizeof(*columns));
struct poptDone_s done_buf;
poptDone done = &done_buf;
@@ -910,7 +910,7 @@ assert(columns); /* XXX can't happen */
if (columns) {
columns->cur = done->maxopts * sizeof(*done->opts);
columns->max = maxColumnWidth(fp);
- done->opts = xcalloc((size_t)1, columns->cur);
+ done->opts = (const void**) xcalloc((size_t)1, columns->cur);
assert(done->opts); /* XXX can't happen */
/*@-keeptrans@*/
if (done->opts != NULL)
diff --git a/poptint.c b/poptint.c
index 67f0051..e12a474 100644
--- a/poptint.c
+++ b/poptint.c
@@ -64,7 +64,7 @@ POPT_dgettext(const char * dom, const char * str)
char * codeset = NULL;
char * retval = NULL;
- if (!dom)
+ if (!dom)
dom = textdomain(NULL);
codeset = bind_textdomain_codeset(dom, NULL);
bind_textdomain_codeset(dom, "UTF-8");
@@ -102,7 +102,7 @@ strdup_locale_from_utf8 (/*@null@*/ char * istr)
char * shift_pin = NULL;
size_t db = strlen(istr);
/*@owned@*/
- char * dstr = xmalloc((db + 1) * sizeof(*dstr));
+ char * dstr = (char*) xmalloc((db + 1) * sizeof(*dstr));
char * pin = istr;
char * pout = dstr;
size_t ib = db;
@@ -128,7 +128,7 @@ assert(dstr); /* XXX can't happen */
case E2BIG:
{ size_t used = (size_t)(pout - dstr);
db *= 2;
- dstr = xrealloc(dstr, (db + 1) * sizeof(*dstr));
+ dstr = (char*) xrealloc(dstr, (db + 1) * sizeof(*dstr));
assert(dstr); /* XXX can't happen */
if (dstr != NULL) {
pout = dstr + used;
@@ -174,7 +174,7 @@ POPT_fprintf (FILE * stream, const char * format, ...)
* to do with whether the final '\0' is counted (or not). The code
* below already adds +1 for the (possibly already counted) trailing NUL.
*/
- while ((b = xrealloc(b, nb+1)) != NULL) {
+ while ((b = (char*) xrealloc(b, nb+1)) != NULL) {
va_start(ap, format);
rc = vsnprintf(b, nb, format, ap);
va_end(ap);