Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148383276
D48733.1786563419.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D48733.1786563419.diff
View Options
diff --git a/contrib/unifdef/unifdef.c b/contrib/unifdef/unifdef.c
--- a/contrib/unifdef/unifdef.c
+++ b/contrib/unifdef/unifdef.c
@@ -1488,7 +1488,7 @@
static void
indirectsym(void)
{
- const char *cp;
+ struct macro key = { 0 };
int changed;
struct macro *sym, *ind;
@@ -1497,10 +1497,9 @@
RB_FOREACH(sym, MACROMAP, ¯o_tree) {
if (sym->value == NULL)
continue;
- cp = sym->value;
- ind = findsym(&cp);
+ key.name = sym->value;
+ ind = RB_FIND(MACROMAP, ¯o_tree, &key);
if (ind == NULL || ind == sym ||
- *cp != '\0' ||
ind->value == NULL ||
ind->value == sym->value)
continue;
@@ -1539,10 +1538,10 @@
static void
addsym2(bool ignorethis, const char *symname, const char *val)
{
- const char *cp = symname;
+ struct macro key = { .name = symname };
struct macro *sym, *r;
- sym = findsym(&cp);
+ sym = RB_FIND(MACROMAP, ¯o_tree, &key);
if (sym == NULL) {
sym = calloc(1, sizeof(*sym));
sym->ignore = ignorethis;
diff --git a/usr.bin/unifdef/tests/unifdef_test.sh b/usr.bin/unifdef/tests/unifdef_test.sh
--- a/usr.bin/unifdef/tests/unifdef_test.sh
+++ b/usr.bin/unifdef/tests/unifdef_test.sh
@@ -36,7 +36,17 @@
atf_check -s exit:1 -o inline:"b\n" unifdef -DFOO -DFOO=0 <file
}
+atf_test_case sDU
+sDU_head() {
+ atf_set descr "simultaneous use of -s and -D or -U"
+}
+sDU_body() {
+ atf_check unifdef -s -DFOO -UFOO /dev/null
+ atf_check unifdef -s -DFOO -DBAR=FOO /dev/null
+}
+
atf_init_test_cases() {
atf_add_test_case hash_comment
atf_add_test_case redefine
+ atf_add_test_case sDU
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 12, 7:36 PM (16 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29399846
Default Alt Text
D48733.1786563419.diff (1 KB)
Attached To
Mode
D48733: unifdef: Fix collision check when adding symbols.
Attached
Detach File
Event Timeline
Log In to Comment