On 15/10/2020 13:27, Frank Kuehndel wrote:
From: Frank Kühndel<frank.kuehn...@embedded-brains.de>
The compiler warning was:
../../../cpukit/libmisc/rtems-fdt/rtems-fdt.c:267:5: warning:
'strncpy' specified bound depends on the length of the source argument
267 | strncpy(path, name, namelen);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
It turns out that the `strncpy()` nor the buffer `path` is needed when
one uses `strncmp()` instead of `strcmp()`. This needs some change to
the algorithm but has the advantage that `name` is never truncated
to the size of the buffer `path`.
Does it help to use bsearch() to simplify this code further?
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel