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.
I agree. The malloc+memcpy style is harder to read. Patch coming soon.
I agree that it looks not nice but if there is not an issue, I would prefer to keep it like it is. Please look at the patch frequency in the project and you will discover that the project has not much contribution. In future it will be even not used by DNF5.