libcomps
libcomps copied to clipboard
use strdup instead of manual malloc+memcpy
In multiple places strings are copied from one place to another, but instead of using strdup
or the str*
functions, the project seems to prefer malloc
+memcpy
, which IMHO results in less readable more error-prone code.
Examples of this: https://github.com/rpm-software-management/libcomps/blob/2ed0fe52d1e7c062a5a42968bb7a7680835914b8/libcomps/src/comps_objmradix.c#L46 https://github.com/rpm-software-management/libcomps/blob/2ed0fe52d1e7c062a5a42968bb7a7680835914b8/libcomps/src/comps_doc.c#L263 https://github.com/rpm-software-management/libcomps/blob/2ed0fe52d1e7c062a5a42968bb7a7680835914b8/libcomps/src/comps_elem.c#L890 https://github.com/rpm-software-management/libcomps/blob/2ed0fe52d1e7c062a5a42968bb7a7680835914b8/libcomps/src/comps_elem.c#L891 .. and many others.