Skip to content

Commit 45849f2

Browse files
committed
Reuse nob in tools more
Also get rid of sv.h
1 parent f9a39b1 commit 45849f2

File tree

5 files changed

+44
-433
lines changed

5 files changed

+44
-433
lines changed

nob.h renamed to dev-deps/nob.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* nob - v1.14.1 - Public Domain - https://github.com/tsoding/nob.h
1+
/* nob - v1.14.1+ - 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
@@ -518,6 +518,7 @@ typedef struct {
518518
const char *nob_temp_sv_to_cstr(Nob_String_View sv);
519519

520520
Nob_String_View nob_sv_chop_by_delim(Nob_String_View *sv, char delim);
521+
Nob_String_View nob_sv_chop_left(Nob_String_View *sv, size_t n);
521522
Nob_String_View nob_sv_trim(Nob_String_View sv);
522523
Nob_String_View nob_sv_trim_left(Nob_String_View sv);
523524
Nob_String_View nob_sv_trim_right(Nob_String_View sv);
@@ -1531,6 +1532,20 @@ Nob_String_View nob_sv_chop_by_delim(Nob_String_View *sv, char delim)
15311532
return result;
15321533
}
15331534

1535+
Nob_String_View nob_sv_chop_left(Nob_String_View *sv, size_t n)
1536+
{
1537+
if (n > sv->count) {
1538+
n = sv->count;
1539+
}
1540+
1541+
Nob_String_View result = nob_sv_from_parts(sv->data, n);
1542+
1543+
sv->data += n;
1544+
sv->count -= n;
1545+
1546+
return result;
1547+
}
1548+
15341549
Nob_String_View nob_sv_from_parts(const char *data, size_t count)
15351550
{
15361551
Nob_String_View sv;
@@ -1846,6 +1861,7 @@ int closedir(DIR *dirp)
18461861
#define String_View Nob_String_View
18471862
#define temp_sv_to_cstr nob_temp_sv_to_cstr
18481863
#define sv_chop_by_delim nob_sv_chop_by_delim
1864+
#define sv_chop_left nob_sv_chop_left
18491865
#define sv_trim nob_sv_trim
18501866
#define sv_trim_left nob_sv_trim_left
18511867
#define sv_trim_right nob_sv_trim_right

dev-deps/sv.h

Lines changed: 0 additions & 318 deletions
This file was deleted.

nob.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define NOB_IMPLEMENTATION
22
#define NOB_STRIP_PREFIX
33
#define NOB_EXPERIMENTAL_DELETE_OLD
4-
#include "./nob.h"
4+
#include "./dev-deps/nob.h"
55

66
#define COMMON_CFLAGS "-Wall", "-Wextra", "-pedantic", "-ggdb", "-I.", "-I./build/", "-I./dev-deps/"
77

0 commit comments

Comments
 (0)