Skip to content

Commit 3f835d7

Browse files
authored
Merge pull request #221 from tsoding/next-release
Release v3.5.0
2 parents e1a29b0 + 27268a4 commit 3f835d7

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

nob.h

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* nob - v3.4.0 - Public Domain - https://github.com/tsoding/nob.h
1+
/* nob - v3.5.0 - 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
@@ -219,13 +219,16 @@ typedef enum {
219219
// Any messages with the level below nob_minimal_log_level are going to be suppressed.
220220
extern Nob_Log_Level nob_minimal_log_level;
221221

222-
typedef void (nob_log_handler)(Nob_Log_Level level, const char *fmt, va_list args);
222+
typedef void (Nob_Log_Handler)(Nob_Log_Level level, const char *fmt, va_list args);
223+
NOB_DEPRECATED("Uncapitalized nob_log_handler type is deprecated. Use Nob_Log_Handler instead. It's just when we were releasing the log handler feature we forgot that we had a convention that all the types must be capitalized like that. Sorry about it!")
224+
typedef Nob_Log_Handler nob_log_handler;
223225

224-
NOBDEF void nob_set_log_handler(nob_log_handler *handler);
225-
NOBDEF nob_log_handler *nob_get_log_handler(void);
226+
NOBDEF void nob_set_log_handler(Nob_Log_Handler *handler);
227+
NOBDEF Nob_Log_Handler *nob_get_log_handler(void);
226228

227-
NOBDEF nob_log_handler nob_default_log_handler;
228-
NOBDEF nob_log_handler nob_cancer_log_handler;
229+
NOBDEF Nob_Log_Handler nob_default_log_handler;
230+
NOBDEF Nob_Log_Handler nob_cancer_log_handler;
231+
NOBDEF Nob_Log_Handler nob_null_log_handler;
229232

230233
NOBDEF void nob_log(Nob_Log_Level level, const char *fmt, ...) NOB_PRINTF_FORMAT(2, 3);
231234

@@ -1849,14 +1852,14 @@ NOBDEF bool nob_cmd_run_sync_redirect_and_reset(Nob_Cmd *cmd, Nob_Cmd_Redirect r
18491852
return nob_proc_wait(p);
18501853
}
18511854

1852-
static nob_log_handler *nob__log_handler = &nob_default_log_handler;
1855+
static Nob_Log_Handler *nob__log_handler = &nob_default_log_handler;
18531856

1854-
NOBDEF void nob_set_log_handler(nob_log_handler *handler)
1857+
NOBDEF void nob_set_log_handler(Nob_Log_Handler *handler)
18551858
{
18561859
nob__log_handler = handler;
18571860
}
18581861

1859-
NOBDEF nob_log_handler *nob_get_log_handler(void)
1862+
NOBDEF Nob_Log_Handler *nob_get_log_handler(void)
18601863
{
18611864
return nob__log_handler;
18621865
}
@@ -1884,6 +1887,13 @@ NOBDEF void nob_default_log_handler(Nob_Log_Level level, const char *fmt, va_lis
18841887
fprintf(stderr, "\n");
18851888
}
18861889

1890+
NOBDEF void nob_null_log_handler(Nob_Log_Level level, const char *fmt, va_list args)
1891+
{
1892+
NOB_UNUSED(level);
1893+
NOB_UNUSED(fmt);
1894+
NOB_UNUSED(args);
1895+
}
1896+
18871897
NOBDEF void nob_cancer_log_handler(Nob_Log_Level level, const char *fmt, va_list args)
18881898
{
18891899
switch (level) {
@@ -2801,8 +2811,10 @@ NOBDEF char *nob_temp_running_executable_path(void)
28012811
#define Log_Level Nob_Log_Level
28022812
#define minimal_log_level nob_minimal_log_level
28032813
#define log_handler nob_log_handler
2814+
#define Log_Handler Nob_Log_Handler
28042815
#define set_log_handler nob_set_log_handler
28052816
#define get_log_handler nob_get_log_handler
2817+
#define null_log_handler nob_null_log_handler
28062818
#define default_log_handler nob_default_log_handler
28072819
#define cancer_log_handler nob_cancer_log_handler
28082820
// NOTE: Name log is already defined in math.h and historically always was the natural logarithmic function.
@@ -2947,6 +2959,8 @@ NOBDEF char *nob_temp_running_executable_path(void)
29472959
/*
29482960
Revision history:
29492961
2962+
3.5.0 (2026-03-13) Add nob_null_log_handler (by @rexim)
2963+
Rename nob_log_handler to Nob_Log_Handler (by @rexim)
29502964
3.4.0 (2026-03-12) Add nob_da_first() (by @rexim)
29512965
Add nob_da_pop() (by @rexim)
29522966
Add nob_sv_chop_while() (by @rexim)

tests/read_entire_dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ int main(void)
2222
Nob_File_Paths empty = {0};
2323

2424
error_counter = 0;
25-
nob_log_handler *saved_log_hander = get_log_handler();
25+
Nob_Log_Handler *saved_log_hander = get_log_handler();
2626
set_log_handler(error_counting_log_handler);
2727
{
2828
bool ok = nob_read_entire_dir("", &empty);

0 commit comments

Comments
 (0)