Skip to content

Commit

Permalink
macro_table: don't store duplicate macros
Browse files Browse the repository at this point in the history
I don't know if this matters...  I had thought that I could use
the get_inner_macro() stuff but it turns out to be useless in practice.
The whole inner/outer idea cannot work.  The only thing that's possible
is to iterate through the whole list of macros.

So since I was iterating through the list, then I decided I didn't want
duplicates.

Signed-off-by: Dan Carpenter <[email protected]>
  • Loading branch information
Dan Carpenter committed May 8, 2023
1 parent 03c0545 commit 4cafc9f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions macro_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ static inline int equalkeys(void *_pos1, void *_pos2)

static void insert_macro_string(struct string_list **str_list, char *new)
{
char *tmp;

if (!new)
return;

FOR_EACH_PTR(*str_list, tmp) {
if (strcmp(tmp, new) == 0)
return;
} END_FOR_EACH_PTR(tmp);

add_ptr_list(str_list, new);
}

Expand Down

0 comments on commit 4cafc9f

Please sign in to comment.