Skip to content

Commit 45fa6ef

Browse files
committed
v1.20.6 Never strip nob_* suffix from nob_rename
1 parent 6c5a74d commit 45fa6ef

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

nob.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define NOB_STRIP_PREFIX
44
#define NOB_EXPERIMENTAL_DELETE_OLD
55
#include "nob.h"
6+
#undef rename // Testing for backward compatibility after v1.20.6
67

78
const char *test_names[] = {
89
"minimal_log_level",

nob.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* nob - v1.20.5 - Public Domain - https://github.com/tsoding/nob.h
1+
/* nob - v1.20.6 - Public Domain - https://github.com/tsoding/nob.h
22
33
This library is the next generation of the [NoBuild](https://github.com/tsoding/nobuild) idea.
44
@@ -151,7 +151,8 @@
151151
for instance will retain their prefix even if NOB_STRIP_PREFIX is enabled. Notable exception is the
152152
nob_log() function. Stripping away the prefix results in log() which was historically always referring
153153
to the natural logarithmic function that is already defined in math.h. So there is no reason to strip
154-
off the prefix for nob_log().
154+
off the prefix for nob_log(). Another exception is nob_rename() which collides with the widely known
155+
POSIX function rename(2) if you strip the prefix off.
155156
156157
The prefixes are stripped off only on the level of preprocessor. The names of the functions in the
157158
compiled object file will still retain the `nob_` prefix. Keep that in mind when you FFI with nob.h
@@ -2013,7 +2014,8 @@ int closedir(DIR *dirp)
20132014
#define temp_save nob_temp_save
20142015
#define temp_rewind nob_temp_rewind
20152016
#define path_name nob_path_name
2016-
#define rename nob_rename
2017+
// NOTE: rename(2) is widely known POSIX function. We never wanna collide with it.
2018+
// #define rename nob_rename
20172019
#define needs_rebuild nob_needs_rebuild
20182020
#define needs_rebuild1 nob_needs_rebuild1
20192021
#define file_exists nob_file_exists
@@ -2039,8 +2041,9 @@ int closedir(DIR *dirp)
20392041
/*
20402042
Revision history:
20412043
2042-
1.20.5 (2025-05-16) NOB_PRINTF_FORMAT() support for MinGW (By KillerxDBr)
2043-
1.20.4 (2025-05-16) More reliable rendering of the Windows command (By vylsaz)
2044+
1.20.6 (2025-05-16) Never strip nob_* suffix from nob_rename (By @rexim)
2045+
1.20.5 (2025-05-16) NOB_PRINTF_FORMAT() support for MinGW (By @KillerxDBr)
2046+
1.20.4 (2025-05-16) More reliable rendering of the Windows command (By @vylsaz)
20442047
1.20.3 (2025-05-16) Add check for __clang__ along with _MSC_VER checks (By @nashiora)
20452048
1.20.2 (2025-04-24) Report the program name that failed to start up in nob_cmd_run_async_redirect() (By @rexim)
20462049
1.20.1 (2025-04-16) Use vsnprintf() in nob_sb_appendf() instead of vsprintf() (By @LainLayer)

0 commit comments

Comments
 (0)