Skip to content

Commit ee7dbed

Browse files
br3akzerojohn-tornblom
authored andcommitted
refactor: rename basename to pkg_basename for macOS compat
macOS declares basename() in <string.h> with a conflicting return type, causing a compile error. Rename the static function to avoid the conflict.
1 parent cfd6ff1 commit ee7dbed

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ along with this program; see the file COPYING. If not, see
2828
*
2929
**/
3030
static const char*
31-
basename(const char *path) {
31+
pkg_basename(const char *path) {
3232
const char* ptr = path;
3333

3434
while(path && *path) {
@@ -139,14 +139,14 @@ int main(int argc, char *argv[]) {
139139
}
140140

141141
if(!output[0]) {
142-
strcpy(output, basename(url));
142+
strcpy(output, pkg_basename(url));
143143
if(endswith(output, ".json")) {
144144
output[strlen(output)-5] = 0;
145145
strcat(output, ".pkg");
146146
}
147147
}
148148

149-
if(dl_package(url, output, on_progress, (void*)basename(output))) {
149+
if(dl_package(url, output, on_progress, (void*)pkg_basename(output))) {
150150
return -1;
151151
}
152152

0 commit comments

Comments
 (0)