gendwarfksyms: make -T symtypes output be in name order
Subsystems (2)
PATCH 1/1 gendwarfksyms: make -T symtypes output be in name order
When writing symtypes information, we iterate through the entire hash table containing type expansions. The key order varies unpredictably as new entries are added, making it harder to compare symtypes between builds.
Resolve this by sorting the type expansions by name before output.
--- scripts/gendwarfksyms/types.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
scripts/gendwarfksyms/types.c +26 -3
@@ -6,6 +6,8 @@#define _GNU_SOURCE#include <inttypes.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <zlib.h> #include "gendwarfksyms.h"
@@ -179,20 +181,41 @@ static int type_map_get(const char *name, struct type_expansion **res)return -1 ; } +static int cmp_expansion_name (const void *p1,const void *p2) +{ +struct type_expansion *const *e1 = p1; +struct type_expansion *const *e2 = p2; + +return strcmp ((*e1)->name, (*e2)->name); +} +static void type_map_write (FILE *file) {struct type_expansion *e;struct hlist_node *tmp; +struct type_expansion **es; +size_t count =0 ; +size_t i =0 ;if (!file)return ; -hash_for_each_safe (type_map, e, tmp, hash) { -checkp (fputs (e->name, file)); +hash_for_each_safe (type_map, e, tmp, hash) + ++count; + es =xmalloc (count *sizeof (struct type_expansion *)); +hash_for_each_safe (type_map, e, tmp, hash) + es[i++] = e; + +qsort (es, count,sizeof (struct type_expansion *), cmp_expansion_name); + +for (i =0 ; i < count; ++i) { +checkp (fputs (es[i]->name, file));checkp (fputs (" " , file)); -type_list_write (&e->expanded, file); +type_list_write (&es[i]->expanded, file);checkp (fputs ("\n" , file)); } + +free (es); }static void type_map_free (void )
Signature · 1 line
2.50.0.rc2.761.g2dc52ea45b-goog
Quoted 6 lines · Giuliano Procida
When writing symtypes information, we iterate through the entire hash table containing type expansions. The key order varies unpredictably as new entries are added, making it harder to compare symtypes between builds.
Resolve this by sorting the type expansions by name before output.
Ah, very nice, thanks!
Hi Giuliano,
Quoted 58 lines · Giuliano Procida
When writing symtypes information, we iterate through the entire hash table containing type expansions. The key order varies unpredictably as new entries are added, making it harder to compare symtypes between builds.
Resolve this by sorting the type expansions by name before output.
Signed-off-by Giuliano Procida <[email protected]>--- scripts/gendwarfksyms/types.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)scripts/gendwarfksyms/types.c +20
-2@@ -6,6 +6,8 @@#define _GNU_SOURCE#include <inttypes.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <zlib.h> #include "gendwarfksyms.h" @@ -179,20 +181,41 @@ static int type_map_get(const char *name, struct type_expansion **res)return -1 ; } +static int cmp_expansion_name (const void *p1,const void *p2) +{ +struct type_expansion *const *e1 = p1; +struct type_expansion *const *e2 = p2; + +return strcmp ((*e1)->name, (*e2)->name); +} +static void type_map_write (FILE *file) {struct type_expansion *e;struct hlist_node *tmp; +struct type_expansion **es; +size_t count =0 ; +size_t i =0 ;if (!file)return ; -hash_for_each_safe (type_map, e, tmp, hash) { -checkp (fputs (e->name, file)); +hash_for_each_safe (type_map, e, tmp, hash) + ++count; + es =xmalloc (count *sizeof (struct type_expansion *)); +hash_for_each_safe (type_map, e, tmp, hash) + es[i++] = e; + +qsort (es, count,sizeof (struct type_expansion *), cmp_expansion_name);
scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 218
Quoted 10 lines
scripts/gendwarfksyms/types.c +6
-1+ +for (i =0 ; i < count; ++i) { +checkp (fputs (es[i]->name, file));checkp (fputs (" " , file)); -type_list_write (&e->expanded, file); +type_list_write (&es[i]->expanded, file);checkp (fputs ("\n" , file)); } + +free (es);
Looks like a nice improvement. Thanks for the patch!
Sami
PATCH 1/1 gendwarfksyms: order -T symtypes output by name
In reply to Giuliano ProcidaWhen writing symtypes information, we iterate through the entire hash table containing type expansions. The key order varies unpredictably as new entries are added, making it harder to compare symtypes between builds.
Resolve this by sorting the type expansions by name before output.
--- scripts/gendwarfksyms/types.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
[Adjusted the first line of the description. Added reviewer tags.
Added missing CC to linux-modules.]
scripts/gendwarfksyms/types.c +26 -3
@@ -6,6 +6,8 @@#define _GNU_SOURCE#include <inttypes.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <zlib.h> #include "gendwarfksyms.h"
@@ -179,20 +181,41 @@ static int type_map_get(const char *name, struct type_expansion **res)return -1 ; } +static int cmp_expansion_name (const void *p1,const void *p2) +{ +struct type_expansion *const *e1 = p1; +struct type_expansion *const *e2 = p2; + +return strcmp ((*e1)->name, (*e2)->name); +} +static void type_map_write (FILE *file) {struct type_expansion *e;struct hlist_node *tmp; +struct type_expansion **es; +size_t count =0 ; +size_t i =0 ;if (!file)return ; -hash_for_each_safe (type_map, e, tmp, hash) { -checkp (fputs (e->name, file)); +hash_for_each_safe (type_map, e, tmp, hash) + ++count; + es =xmalloc (count *sizeof (struct type_expansion *)); +hash_for_each_safe (type_map, e, tmp, hash) + es[i++] = e; + +qsort (es, count,sizeof (struct type_expansion *), cmp_expansion_name); + +for (i =0 ; i < count; ++i) { +checkp (fputs (es[i]->name, file));checkp (fputs (" " , file)); -type_list_write (&e->expanded, file); +type_list_write (&es[i]->expanded, file);checkp (fputs ("\n" , file)); } + +free (es); }static void type_map_free (void )
Signature · 1 line
2.50.0.714.g196bf9f422-goog
Re: [PATCH] gendwarfksyms: order -T symtypes output by name
Quoted 49 lines · Giuliano Procida
When writing symtypes information, we iterate through the entire hash table containing type expansions. The key order varies unpredictably as new entries are added, making it harder to compare symtypes between builds.
Resolve this by sorting the type expansions by name before output.
Signed-off-by Giuliano Procida <[email protected]>Reviewed-by Sami Tolvanen <[email protected]>--- scripts/gendwarfksyms/types.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)[Adjusted the first line of the description. Added reviewer tags.
Added missing CC to linux-modules.]scripts/gendwarfksyms/types.c +12
-0@@ -6,6 +6,8 @@#define _GNU_SOURCE#include <inttypes.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <zlib.h> #include "gendwarfksyms.h" @@ -179,20 +181,41 @@ static int type_map_get(const char *name, struct type_expansion **res)return -1 ; } +static int cmp_expansion_name (const void *p1,const void *p2) +{ +struct type_expansion *const *e1 = p1; +struct type_expansion *const *e2 = p2; + +return strcmp ((*e1)->name, (*e2)->name); +} +static void type_map_write (FILE *file) {struct type_expansion *e;struct hlist_node *tmp; +struct type_expansion **es; +size_t count =0 ;
scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 205
Quoted 10 lines
scripts/gendwarfksyms/types.c +4
-2+size_t i =0 ;if (!file)return ; -hash_for_each_safe (type_map, e, tmp, hash) { -checkp (fputs (e->name, file)); +hash_for_each_safe (type_map, e, tmp, hash) + ++count; + es =xmalloc (count *sizeof (struct type_expansion *));
Just a nit:
es = xmalloc(count * sizeof(*es));
is better?
scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 209
Quoted 4 lines
scripts/gendwarfksyms/types.c +4
-0+hash_for_each_safe (type_map, e, tmp, hash) + es[i++] = e; + +qsort (es, count,sizeof (struct type_expansion *), cmp_expansion_name);
qsort(es, count, sizeof(*es), cmp_expansion_name);
Quoted 14 lines
scripts/gendwarfksyms/types.c +6
-2+ +for (i =0 ; i < count; ++i) { +checkp (fputs (es[i]->name, file));checkp (fputs (" " , file)); -type_list_write (&e->expanded, file); +type_list_write (&es[i]->expanded, file);checkp (fputs ("\n" , file)); } + +free (es); }static void type_map_free (void ) --
Quoted 3 lines
2.50.0.714.g196bf9f422-goog
--
Best Regards
Masahiro Yamada
Re: [PATCH] gendwarfksyms: order -T symtypes output by name
Hi.
Quoted 66 lines · Masahiro Yamada
Quoted 49 lines · Giuliano Procida
When writing symtypes information, we iterate through the entire hash table containing type expansions. The key order varies unpredictably as new entries are added, making it harder to compare symtypes between builds.
Resolve this by sorting the type expansions by name before output.
Signed-off-by Giuliano Procida <[email protected]>Reviewed-by Sami Tolvanen <[email protected]>--- scripts/gendwarfksyms/types.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)[Adjusted the first line of the description. Added reviewer tags.
Added missing CC to linux-modules.]scripts/gendwarfksyms/types.c +12
-0@@ -6,6 +6,8 @@#define _GNU_SOURCE#include <inttypes.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <zlib.h> #include "gendwarfksyms.h" @@ -179,20 +181,41 @@ static int type_map_get(const char *name, struct type_expansion **res)return -1 ; } +static int cmp_expansion_name (const void *p1,const void *p2) +{ +struct type_expansion *const *e1 = p1; +struct type_expansion *const *e2 = p2; + +return strcmp ((*e1)->name, (*e2)->name); +} +static void type_map_write (FILE *file) {struct type_expansion *e;struct hlist_node *tmp; +struct type_expansion **es; +size_t count =0 ;scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 205
Quoted 10 lines
scripts/gendwarfksyms/types.c +4
-2+size_t i =0 ;if (!file)return ; -hash_for_each_safe (type_map, e, tmp, hash) { -checkp (fputs (e->name, file)); +hash_for_each_safe (type_map, e, tmp, hash) + ++count; + es =xmalloc (count *sizeof (struct type_expansion *));Just a nit:
es = xmalloc(count * sizeof(*es));
Quoted 9 lines
is better?
scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 209
Quoted 4 lines
scripts/gendwarfksyms/types.c +4
-0+hash_for_each_safe (type_map, e, tmp, hash) + es[i++] = e; + +qsort (es, count,sizeof (struct type_expansion *), cmp_expansion_name);
qsort(es, count, sizeof(*es), cmp_expansion_name);
That's a fair point.
However, in the gendwarfksyms code, all but one of the sizeofs uses an explicit type name. The exception is sizeof(stats) where stats is an array.
I'll leave Sami's code as it is.
Giuliano.
Quoted 23 lines
Quoted 15 lines
scripts/gendwarfksyms/types.c +6
-2+ +for (i =0 ; i < count; ++i) { +checkp (fputs (es[i]->name, file));checkp (fputs (" " , file)); -type_list_write (&e->expanded, file); +type_list_write (&es[i]->expanded, file);checkp (fputs ("\n" , file)); } + +free (es); }static void type_map_free (void ) --Quoted 3 lines
2.50.0.714.g196bf9f422-goog
--
Best Regards
Masahiro Yamada
Re: [PATCH] gendwarfksyms: order -T symtypes output by name
Quoted 80 lines · Giuliano Procida
Hi.
Quoted 66 lines · Masahiro Yamada
Quoted 49 lines · Giuliano Procida
When writing symtypes information, we iterate through the entire hash table containing type expansions. The key order varies unpredictably as new entries are added, making it harder to compare symtypes between builds.
Resolve this by sorting the type expansions by name before output.
Signed-off-by Giuliano Procida <[email protected]>Reviewed-by Sami Tolvanen <[email protected]>--- scripts/gendwarfksyms/types.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)[Adjusted the first line of the description. Added reviewer tags.
Added missing CC to linux-modules.]scripts/gendwarfksyms/types.c +12
-0@@ -6,6 +6,8 @@#define _GNU_SOURCE#include <inttypes.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <zlib.h> #include "gendwarfksyms.h" @@ -179,20 +181,41 @@ static int type_map_get(const char *name, struct type_expansion **res)return -1 ; } +static int cmp_expansion_name (const void *p1,const void *p2) +{ +struct type_expansion *const *e1 = p1; +struct type_expansion *const *e2 = p2; + +return strcmp ((*e1)->name, (*e2)->name); +} +static void type_map_write (FILE *file) {struct type_expansion *e;struct hlist_node *tmp; +struct type_expansion **es; +size_t count =0 ;scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 205
Quoted 10 lines
scripts/gendwarfksyms/types.c +4
-2+size_t i =0 ;if (!file)return ; -hash_for_each_safe (type_map, e, tmp, hash) { -checkp (fputs (e->name, file)); +hash_for_each_safe (type_map, e, tmp, hash) + ++count; + es =xmalloc (count *sizeof (struct type_expansion *));Just a nit:
es = xmalloc(count * sizeof(*es));Quoted 9 lines
is better?
scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 209
Quoted 4 lines
scripts/gendwarfksyms/types.c +4
-0+hash_for_each_safe (type_map, e, tmp, hash) + es[i++] = e; + +qsort (es, count,sizeof (struct type_expansion *), cmp_expansion_name);
qsort(es, count, sizeof(*es), cmp_expansion_name);
Quoted 6 lines
That's a fair point.
However, in the gendwarfksyms code, all but one of the sizeofs uses an explicit type name. The exception is sizeof(stats) where stats is an array.
I'll leave Sami's code as it is.
This rule is clearly documented with rationale.
See this:
https://github.com/torvalds/linux/blob/v6.15/Documentation/process/coding-style.rst?plain=1#L941
--
Best Regards
Masahiro Yamada
Re: [PATCH] gendwarfksyms: order -T symtypes output by name
Quoted 87 lines · Masahiro Yamada
Quoted 85 lines · Giuliano Procida
Hi.
Quoted 66 lines · Masahiro Yamada
Quoted 49 lines · Giuliano Procida
When writing symtypes information, we iterate through the entire hash table containing type expansions. The key order varies unpredictably as new entries are added, making it harder to compare symtypes between builds.
Resolve this by sorting the type expansions by name before output.
Signed-off-by Giuliano Procida <[email protected]>Reviewed-by Sami Tolvanen <[email protected]>--- scripts/gendwarfksyms/types.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)[Adjusted the first line of the description. Added reviewer tags.
Added missing CC to linux-modules.]scripts/gendwarfksyms/types.c +12
-0@@ -6,6 +6,8 @@#define _GNU_SOURCE#include <inttypes.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <zlib.h> #include "gendwarfksyms.h" @@ -179,20 +181,41 @@ static int type_map_get(const char *name, struct type_expansion **res)return -1 ; } +static int cmp_expansion_name (const void *p1,const void *p2) +{ +struct type_expansion *const *e1 = p1; +struct type_expansion *const *e2 = p2; + +return strcmp ((*e1)->name, (*e2)->name); +} +static void type_map_write (FILE *file) {struct type_expansion *e;struct hlist_node *tmp; +struct type_expansion **es; +size_t count =0 ;scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 205
Quoted 10 lines
scripts/gendwarfksyms/types.c +4
-2+size_t i =0 ;if (!file)return ; -hash_for_each_safe (type_map, e, tmp, hash) { -checkp (fputs (e->name, file)); +hash_for_each_safe (type_map, e, tmp, hash) + ++count; + es =xmalloc (count *sizeof (struct type_expansion *));Just a nit:
es = xmalloc(count * sizeof(*es));Quoted 9 lines
is better?
scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 209
Quoted 4 lines
scripts/gendwarfksyms/types.c +4
-0+hash_for_each_safe (type_map, e, tmp, hash) + es[i++] = e; + +qsort (es, count,sizeof (struct type_expansion *), cmp_expansion_name);
qsort(es, count, sizeof(*es), cmp_expansion_name);That's a fair point.
However, in the gendwarfksyms code, all but one of the sizeofs uses an explicit type name. The exception is sizeof(stats) where stats is an array.
Quoted 9 lines
Quoted 1 line
I'll leave Sami's code as it is.
This rule is clearly documented with rationale.
See this:
https://github.com/torvalds/linux/blob/v6.15/Documentation/process/coding-style.rst?plain=1#L941
I can follow up with a change that adjusts all occurrences. That shouldn't take long at all.
Quoted 4 lines
--
Best Regards
Masahiro Yamada
PATCH 1/1 gendwarfksyms: use preferred form of sizeof for allocation
The preferred form is to supply the variable being allocated to rather than an explicit type name which might become stale.
Also do this for memset and qsort arguments.
--- scripts/gendwarfksyms/cache.c | 2 +- scripts/gendwarfksyms/die.c | 4 ++-- scripts/gendwarfksyms/dwarf.c | 2 +- scripts/gendwarfksyms/kabi.c | 2 +- scripts/gendwarfksyms/symbols.c | 2 +- scripts/gendwarfksyms/types.c | 8 ++++---- 6 files changed, 10 insertions(+), 10 deletions(-)
scripts/gendwarfksyms/cache.c +1 -1
@@ -15,7 +15,7 @@ void cache_set(struct cache *cache, unsigned long key, int value) {struct cache_item *ci; - ci =xmalloc (sizeof (struct cache_item )); + ci =xmalloc (sizeof (*ci)); ci->key = key; ci->value = value;hash_add (cache->cache, &ci->hash,hash_32 (key));
scripts/gendwarfksyms/die.c +2 -2
@@ -33,7 +33,7 @@ static struct die *create_die(Dwarf_Die *die, enum die_state state) {struct die *cd; - cd =xmalloc (sizeof (struct die )); + cd =xmalloc (sizeof (*cd));init_die (cd); cd->addr = (uintptr_t )die->addr;
@@ -123,7 +123,7 @@ static struct die_fragment *append_item(struct die *cd) {struct die_fragment *df; - df =xmalloc (sizeof (struct die_fragment )); + df =xmalloc (sizeof (*df)); df->type =FRAGMENT_EMPTY ;list_add_tail (&df->list, &cd->fragments);return df;
scripts/gendwarfksyms/dwarf.c +1 -1
@@ -634,7 +634,7 @@ static int get_union_kabi_status(Dwarf_Die *die, Dwarf_Die *placeholder,* Note that the user of this feature is responsible for ensuring * that the structure actually remains ABI compatible. */ -memset (&state.kabi,0 ,sizeof (struct kabi_state )); +memset (&state.kabi,0 ,sizeof (state.kabi)); res = checkp(process_die_container(&state, NULL, die, check_union_member_kabi_status,
scripts/gendwarfksyms/kabi.c +1 -1
@@ -228,7 +228,7 @@ void kabi_read_rules(int fd)if (type ==KABI_RULE_TYPE_UNKNOWN )error ("unsupported kABI rule type: '%s'" , field); - rule =xmalloc (sizeof (struct rule )); + rule =xmalloc (sizeof (*rule)); rule->type = type; rule->target =xstrdup (get_rule_field (&rule_str, &left));
scripts/gendwarfksyms/symbols.c +1 -1
@@ -146,7 +146,7 @@ void symbol_read_exports(FILE *file)continue ; } - sym =xcalloc (1 ,sizeof (struct symbol )); + sym =xcalloc (1 ,sizeof (*sym)); sym->name = name; sym->addr.section =SHN_UNDEF ; sym->state =SYMBOL_UNPROCESSED ;
scripts/gendwarfksyms/types.c +4 -4
@@ -45,7 +45,7 @@ static int type_list_append(struct list_head *list, const char *s, void *owned)if (!s)return 0 ; - entry =xmalloc (sizeof (struct type_list_entry )); + entry =xmalloc (sizeof (*entry)); entry->str = s; entry->owned = owned;list_add_tail (&entry->list, list);
@@ -122,7 +122,7 @@ static struct type_expansion *type_map_add(const char *name,struct type_expansion *e;if (__type_map_get (name, &e)) { - e =xmalloc (sizeof (struct type_expansion )); + e =xmalloc (sizeof (*e));type_expansion_init (e); e->name =xstrdup (name);
@@ -202,11 +202,11 @@ static void type_map_write(FILE *file)hash_for_each_safe (type_map, e, tmp, hash) ++count; - es =xmalloc (count *sizeof (struct type_expansion *)); + es =xmalloc (count *sizeof (*es));hash_for_each_safe (type_map, e, tmp, hash) es[i++] = e; -qsort (es, count,sizeof (struct type_expansion *), cmp_expansion_name); +qsort (es, count,sizeof (*es), cmp_expansion_name);for (i =0 ; i < count; ++i) {checkp (fputs (es[i]->name, file));
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog
Re: [PATCH] gendwarfksyms: order -T symtypes output by name
In reply to Giuliano ProcidaQuoted 94 lines · Giuliano Procida
Quoted 92 lines · Masahiro Yamada
Quoted 80 lines · Giuliano Procida
Hi.
Quoted 66 lines · Masahiro Yamada
Quoted 49 lines · Giuliano Procida
When writing symtypes information, we iterate through the entire hash table containing type expansions. The key order varies unpredictably as new entries are added, making it harder to compare symtypes between builds.
Resolve this by sorting the type expansions by name before output.
Signed-off-by Giuliano Procida <[email protected]>Reviewed-by Sami Tolvanen <[email protected]>--- scripts/gendwarfksyms/types.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)[Adjusted the first line of the description. Added reviewer tags.
Added missing CC to linux-modules.]scripts/gendwarfksyms/types.c +12
-0@@ -6,6 +6,8 @@#define _GNU_SOURCE#include <inttypes.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <zlib.h> #include "gendwarfksyms.h" @@ -179,20 +181,41 @@ static int type_map_get(const char *name, struct type_expansion **res)return -1 ; } +static int cmp_expansion_name (const void *p1,const void *p2) +{ +struct type_expansion *const *e1 = p1; +struct type_expansion *const *e2 = p2; + +return strcmp ((*e1)->name, (*e2)->name); +} +static void type_map_write (FILE *file) {struct type_expansion *e;struct hlist_node *tmp; +struct type_expansion **es; +size_t count =0 ;scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 205
Quoted 10 lines
scripts/gendwarfksyms/types.c +4
-2+size_t i =0 ;if (!file)return ; -hash_for_each_safe (type_map, e, tmp, hash) { -checkp (fputs (e->name, file)); +hash_for_each_safe (type_map, e, tmp, hash) + ++count; + es =xmalloc (count *sizeof (struct type_expansion *));Just a nit:
es = xmalloc(count * sizeof(*es));Quoted 9 lines
is better?
scripts/gendwarfksyms/types.c static int type_map_get(const char *name, struct type_expansion **res) · line 209
Quoted 4 lines
scripts/gendwarfksyms/types.c +4
-0+hash_for_each_safe (type_map, e, tmp, hash) + es[i++] = e; + +qsort (es, count,sizeof (struct type_expansion *), cmp_expansion_name);
qsort(es, count, sizeof(*es), cmp_expansion_name);Quoted 6 lines
That's a fair point.
However, in the gendwarfksyms code, all but one of the sizeofs uses an explicit type name. The exception is sizeof(stats) where stats is an array.
I'll leave Sami's code as it is.
This rule is clearly documented with rationale.
Quoted 7 lines
Quoted 4 lines
See this:
https://github.com/torvalds/linux/blob/v6.15/Documentation/process/coding-style.rst?plain=1#L941I can follow up with a change that adjusts all occurrences. That shouldn't take long at all.
I expected a new patch version (I do not know whether it is v2 or v3 since you do not add such a prefix),
instead of breaking the style, and fixing it in a follow-up patch.
--
Best Regards
Masahiro Yamada