Skip to content

Commit 377ecd1

Browse files
committed
file_is_newer: fix compilation on Mac
OSX suddenly started failing the build due to implicit declaration of file_is_newer. It was defined in ImageJ.c but only used in file-funcs.c Fixed by moving to file-funcs and externalizing
1 parent e2ba50e commit 377ecd1

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/main/c/ImageJ.c

-9
Original file line numberDiff line numberDiff line change
@@ -595,15 +595,6 @@ static void show_commandline(struct options *options)
595595
fputc('\n', stdout);
596596
}
597597

598-
int file_is_newer(const char *path, const char *than)
599-
{
600-
struct stat st1, st2;
601-
602-
if (stat(path, &st1))
603-
return 0;
604-
return stat(than, &st2) || st1.st_mtime > st2.st_mtime;
605-
}
606-
607598
int handle_one_option(int *i, const char **argv, const char *option, struct string *arg)
608599
{
609600
int len;

src/main/c/file-funcs.c

+10
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@
3636

3737
#include <sys/stat.h>
3838

39+
int file_is_newer(const char *path, const char *than)
40+
{
41+
struct stat st1, st2;
42+
43+
if (stat(path, &st1))
44+
return 0;
45+
return stat(than, &st2) || st1.st_mtime > st2.st_mtime;
46+
}
47+
48+
3949
int find_file(struct string *search_root, int max_depth, const char *file, struct string *result)
4050
{
4151
int len = search_root->length;

src/main/include/file-funcs.h

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
#include "string-funcs.h"
3333

34+
extern int file_is_newer(const char *path, const char *than);
3435
extern int find_file(struct string *search_root, int max_depth, const char *file, struct string *result);
3536
extern void detect_library_path(struct string *library_path, struct string *directory);
3637

0 commit comments

Comments
 (0)