Make SJ4 more portable

This commit is contained in:
Nishi 2026-06-22 05:24:16 +09:00
commit a160b81246
3 changed files with 2 additions and 8 deletions

View file

@ -14,6 +14,5 @@
int sj4_snprintf(char*, size_t, const char*, ...); int sj4_snprintf(char*, size_t, const char*, ...);
size_t sj4_strlcpy(char*, const char*, size_t); size_t sj4_strlcpy(char*, const char*, size_t);
int sj4_ftruncate(FILE*, size_t); int sj4_ftruncate(FILE*, size_t);
int sj4_unlink(const char*);
#endif #endif

View file

@ -1,5 +0,0 @@
#include "sj4compat.h"
int sj4_unlink(const char* path) {
return unlink(path);
}

View file

@ -607,7 +607,7 @@ int makedict(char* path, int idxlen, int seglen, int segnum) {
ret = SJ4_NormalEnd; ret = SJ4_NormalEnd;
error: error:
fclose(fp); fclose(fp);
if(ret != SJ4_NormalEnd) sj4_unlink(path); if(ret != SJ4_NormalEnd) remove(path);
return ret; return ret;
} }
@ -687,7 +687,7 @@ int makestdy(char* path, int stynum, int clstep, int cllen) {
ret = SJ4_NormalEnd; ret = SJ4_NormalEnd;
error: error:
fclose(fp); fclose(fp);
if(ret != SJ4_NormalEnd) sj4_unlink(path); if(ret != SJ4_NormalEnd) remove(path);
return ret; return ret;
} }