Prevent useless use of strdup(3)
Obtained from: NetBSD
This commit is contained in:
parent
1dd178d10d
commit
224c825745
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282460
@ -124,6 +124,8 @@ bool l_toplex; /* procedures only defined at top lex level */
|
|||||||
const char *language = "c"; /* the language indicator */
|
const char *language = "c"; /* the language indicator */
|
||||||
|
|
||||||
#define ps(x) printf("%s", x)
|
#define ps(x) printf("%s", x)
|
||||||
|
static char minus[] = "-";
|
||||||
|
static char minusn[] = "-n";
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
@ -158,7 +160,7 @@ main(int argc, char **argv)
|
|||||||
if (!strcmp(argv[0], "-f")) {
|
if (!strcmp(argv[0], "-f")) {
|
||||||
filter = true;
|
filter = true;
|
||||||
argv[0] = argv[argc-1];
|
argv[0] = argv[argc-1];
|
||||||
argv[argc-1] = strdup("-");
|
argv[argc-1] = minus;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +173,7 @@ main(int argc, char **argv)
|
|||||||
/* build an index */
|
/* build an index */
|
||||||
if (!strcmp(argv[0], "-x")) {
|
if (!strcmp(argv[0], "-x")) {
|
||||||
idx = true;
|
idx = true;
|
||||||
argv[0] = strdup("-n");
|
argv[0] = minusn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* indicate no keywords */
|
/* indicate no keywords */
|
||||||
|
Loading…
Reference in New Issue
Block a user