busctl: add and use strcmp_ptr()
In member_compare_func(), it compares interface, type and name of members. But as it can contain NULL pointer, it needs to check them before calling strcmp(). So make it as a separate strcmp_ptr function (named after streq_ptr) so that it can be used by others. Also let streq_ptr() to use it in order to make the code simpler.
This commit is contained in:
@@ -71,6 +71,7 @@ size_t page_size(void) _pure_;
|
||||
#define strncaseeq(a, b, n) (strncasecmp((a), (b), (n)) == 0)
|
||||
|
||||
bool streq_ptr(const char *a, const char *b) _pure_;
|
||||
int strcmp_ptr(const char *a, const char *b) _pure_;
|
||||
|
||||
#define new(t, n) ((t*) malloc_multiply(sizeof(t), (n)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user