summaryrefslogtreecommitdiff
path: root/popthelp.c
diff options
context:
space:
mode:
authorjbj <jbj>2002-06-22 18:51:58 +0000
committerjbj <jbj>2002-06-22 18:51:58 +0000
commit633edfc5875731b9065bd152b10c4d24f2013e09 (patch)
tree397e35f17f14e99962014f6eb239a02af068c956 /popthelp.c
parent1ae7dba01f4ecf02e2567be72894ac8ecfa2bc95 (diff)
downloadlibpopt-633edfc5875731b9065bd152b10c4d24f2013e09.tar.gz
Factor bounds checking annotations into source code.
Diffstat (limited to 'popthelp.c')
-rw-r--r--popthelp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/popthelp.c b/popthelp.c
index 261740b..5f9d54f 100644
--- a/popthelp.c
+++ b/popthelp.c
@@ -131,6 +131,7 @@ singleOptionDefaultValue(int lineLength,
char * l = le;
if (le == NULL) return NULL; /* XXX can't happen */
+/*@-boundswrite@*/
*le = '\0';
*le++ = '(';
strcpy(le, defstr); le += strlen(le);
@@ -177,6 +178,7 @@ singleOptionDefaultValue(int lineLength,
}
*le++ = ')';
*le = '\0';
+/*@=boundswrite@*/
return l;
}
@@ -207,6 +209,7 @@ static void singleOptionHelp(FILE * fp, int maxLeftCol,
if (opt->longName) nb += strlen(opt->longName);
if (argDescrip) nb += strlen(argDescrip);
+/*@-boundswrite@*/
left = malloc(nb);
if (left == NULL) return; /* XXX can't happen */
left[0] = '\0';
@@ -223,6 +226,7 @@ static void singleOptionHelp(FILE * fp, int maxLeftCol,
((opt->argInfo & POPT_ARGFLAG_ONEDASH) ? "-" : "--"),
opt->longName);
if (!*left) goto out;
+
if (argDescrip) {
char * le = left + strlen(left);
@@ -306,6 +310,7 @@ static void singleOptionHelp(FILE * fp, int maxLeftCol,
*le++ = ']';
*le = '\0';
}
+/*@=boundswrite@*/
if (help)
fprintf(fp," %-*s ", maxLeftCol, left);
@@ -634,6 +639,7 @@ static int showShortOptions(const struct poptOption * opt, FILE * fp,
}
/*@=branchstate@*/
+/*@-boundswrite@*/
if (opt != NULL)
for (; (opt->longName || opt->shortName || opt->arg); opt++) {
if (opt->shortName && !(opt->argInfo & POPT_ARG_MASK))
@@ -642,6 +648,7 @@ static int showShortOptions(const struct poptOption * opt, FILE * fp,
if (opt->arg) /* XXX program error */
(void) showShortOptions(opt->arg, fp, str);
}
+/*@=boundswrite@*/
if (s != str || *s != '\0')
return 0;