macro: introduce POINTER_MAX as define for (void*) -1
Just add a safer, prettier way to write (void*) -1, that doesn't rely on two's complement, but uses the correct underlying C constructs.
This commit is contained in:
committed by
Yu Watanabe
parent
6c5496c492
commit
66032ef489
@@ -550,7 +550,7 @@ char* path_join_internal(const char *first, ...) {
|
||||
|
||||
sz = strlen_ptr(first);
|
||||
va_start(ap, first);
|
||||
while ((p = va_arg(ap, char*)) != (const char*) -1)
|
||||
while ((p = va_arg(ap, char*)) != POINTER_MAX)
|
||||
if (!isempty(p))
|
||||
sz += 1 + strlen(p);
|
||||
va_end(ap);
|
||||
@@ -570,7 +570,7 @@ char* path_join_internal(const char *first, ...) {
|
||||
}
|
||||
|
||||
va_start(ap, first);
|
||||
while ((p = va_arg(ap, char*)) != (const char*) -1) {
|
||||
while ((p = va_arg(ap, char*)) != POINTER_MAX) {
|
||||
if (isempty(p))
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user