Kouhei Sutou
null+****@clear*****
Wed Apr 15 23:45:32 JST 2015
Kouhei Sutou 2015-04-15 23:45:32 +0900 (Wed, 15 Apr 2015) New Revision: fd20a88ec6ffc01eefd42de8336ee6dda5e1d467 https://github.com/groonga/groonga/commit/fd20a88ec6ffc01eefd42de8336ee6dda5e1d467 Message: windows: use _unlink() on Windows Modified files: build/ac_macros/check_functions.m4 config.h.cmake include/groonga/portability.h lib/dat.cpp lib/grn.h lib/ii.c lib/io.c Modified: build/ac_macros/check_functions.m4 (+0 -1) =================================================================== --- build/ac_macros/check_functions.m4 2015-04-15 23:42:17 +0900 (72e3a9a) +++ build/ac_macros/check_functions.m4 2015-04-15 23:45:32 +0900 (2e5e94a) @@ -14,5 +14,4 @@ AC_CHECK_FUNCS(read) AC_CHECK_FUNCS(strcasecmp) AC_CHECK_FUNCS(strncasecmp) AC_CHECK_FUNCS(strtoull) -AC_CHECK_FUNCS(unlink) AC_CHECK_FUNCS(write) Modified: config.h.cmake (+0 -1) =================================================================== --- config.h.cmake 2015-04-15 23:42:17 +0900 (65699f8) +++ config.h.cmake 2015-04-15 23:45:32 +0900 (1962b5b) @@ -154,7 +154,6 @@ #cmakedefine HAVE_STRCASECMP #cmakedefine HAVE_STRNCASECMP #cmakedefine HAVE_STRTOULL -#cmakedefine HAVE_UNLINK #cmakedefine HAVE_WRITE #cmakedefine HAVE_PTHREAD_MUTEXATTR_SETPSHARED #cmakedefine HAVE_PTHREAD_CONDATTR_SETPSHARED Modified: include/groonga/portability.h (+6 -0) =================================================================== --- include/groonga/portability.h 2015-04-15 23:42:17 +0900 (6de039a) +++ include/groonga/portability.h 2015-04-15 23:45:32 +0900 (152371e) @@ -77,4 +77,10 @@ # define grn_strdup_raw(string) strdup((string)) #endif /* WIN32 */ +#ifdef WIN32 +# define grn_unlink(filename) _unlink((filename)) +#else /* WIN32 */ +# define grn_unlink(filename) unlink((filename)) +#endif /* WIN32 */ + #endif /* GROONGA_PORTABILITY_H */ Modified: lib/dat.cpp (+1 -1) =================================================================== --- lib/dat.cpp 2015-04-15 23:42:17 +0900 (faae04e) +++ lib/dat.cpp 2015-04-15 23:45:32 +0900 (60588d5) @@ -70,7 +70,7 @@ bool grn_dat_remove_file(grn_ctx *ctx, const char *path) { struct stat stat; - return !::stat(path, &stat) && !unlink(path); + return !::stat(path, &stat) && !grn_unlink(path); } grn_rc Modified: lib/grn.h (+0 -3) =================================================================== --- lib/grn.h 2015-04-15 23:42:17 +0900 (2af41e6) +++ lib/grn.h 2015-04-15 23:45:32 +0900 (d23450a) @@ -122,9 +122,6 @@ # if !defined(__GNUC__) && _MSC_VER < 1500 # define vsnprintf(str, size, format, ap) _vsnprintf(str, size, format, ap) # endif /* !defined(__GNUC__) && _MSC_VER < 1500 */ -# ifndef HAVE_UNLINK -# define unlink(pathname) _unlink(pathname) -# endif # define getpid() _getpid() # if !defined(__GNUC__) && _MSC_VER < 1400 # define fstat(fd, buf) _fstat(fd, buf) Modified: lib/ii.c (+2 -2) =================================================================== --- lib/ii.c 2015-04-15 23:42:17 +0900 (4e98da4) +++ lib/ii.c 2015-04-15 23:45:32 +0900 (0904bc7) @@ -7826,7 +7826,7 @@ grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer) "tmpfile_size:%" GRN_FMT_INT64D " > total_chunk_size:%" GRN_FMT_SIZE, ii_buffer->filepos, ii_buffer->total_chunk_size); GRN_CLOSE(ii_buffer->tmpfd); - unlink(ii_buffer->tmpfpath); + grn_unlink(ii_buffer->tmpfpath); ii_buffer->tmpfd = -1; return ctx->rc; } @@ -7845,7 +7845,7 @@ grn_ii_buffer_close(grn_ctx *ctx, grn_ii_buffer *ii_buffer) } if (ii_buffer->tmpfd != -1) { GRN_CLOSE(ii_buffer->tmpfd); - unlink(ii_buffer->tmpfpath); + grn_unlink(ii_buffer->tmpfpath); } if (ii_buffer->block_buf) { GRN_FREE(ii_buffer->block_buf); Modified: lib/io.c (+2 -2) =================================================================== --- lib/io.c 2015-04-15 23:42:17 +0900 (a16fdfb) +++ lib/io.c 2015-04-15 23:45:32 +0900 (324d30e) @@ -718,7 +718,7 @@ grn_io_remove(grn_ctx *ctx, const char *path) if (stat(path, &s)) { SERR("stat"); return ctx->rc; - } else if (unlink(path)) { + } else if (grn_unlink(path)) { ERRNO_ERR(path); return ctx->rc; } else { @@ -727,7 +727,7 @@ grn_io_remove(grn_ctx *ctx, const char *path) for (fno = 1; ; fno++) { gen_pathname(path, buffer, fno); if (!stat(buffer, &s)) { - if (unlink(buffer)) { + if (grn_unlink(buffer)) { ERRNO_ERR(buffer); } } else { -------------- next part -------------- HTML����������������������������...Download