Skip to content

Commit 4be994d

Browse files
committedApr 26, 2016
remove config repository code
1 parent 186f918 commit 4be994d

16 files changed

+36
-2356
lines changed
 

‎CHANGELOG

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ Added a minimal in-place JSON parser. Also parses simplified JSON.
66
Added implementation SHA-2 256 and 512 bit algorithms, including uint256_t and uint512_t
77
representation data types with string conversions.
88

9-
Changed configuration module to use explicit given configuration storage. Changed config
10-
storage format to use simplified json. Removed config_load function.
9+
Removed configuration repository since it is mostly replaced by JSON parser.
1110

1211
Changed byte order representation of raw digest from md5_get_digest_raw to generate
1312
correct string representation using string_from_uint128.
@@ -30,7 +29,8 @@ Android build now requires NDK r11 and uses clang by default, with built in
3029
thread local storage support instead of old pthread api wrappers.
3130

3231
Refactored the ninja build generator into modules to be easier to extend and maintain
33-
instead of a single monolithic file. Minor changes in generator interface.
32+
instead of a single monolithic file. Minor changes in generator interface. Build only
33+
x86-64 target on Windows by default (x86 still supported).
3434

3535

3636
1.4.1

‎README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ functions to write applications and games in a platform-independent fashion. It
1717
* String handling in UTF-8 and UTF-16
1818
* Murmur hasing and statically hashed strings
1919
* Math support for 32 and 64 bit floats
20-
* Configuration repository with config file I/O
20+
* JSON/SJSON parser
21+
* SHA256/SHA512 digest
2122
* Application, environment and system queries and control
2223
* Regular expressions
2324
* Exception utilities (SEH, signals)

‎config/foundation.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
foundation = {
2-
temporary_memory = 0
3-
memory_tracker = local
1+
{
2+
"foundation" : {
3+
"temporary_memory": 0,
4+
"memory_tracker": "local"
5+
}
46
}

‎configure.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
foundation_sources = [
1919
'android.c', 'array.c', 'assert.c', 'assetstream.c', 'atomic.c', 'base64.c', 'beacon.c', 'bitbuffer.c', 'blowfish.c',
20-
'bufferstream.c', 'config.c', 'environment.c', 'error.c', 'event.c', 'exception.c', 'foundation.c', 'fs.c',
20+
'bufferstream.c', 'environment.c', 'error.c', 'event.c', 'exception.c', 'foundation.c', 'fs.c',
2121
'hash.c', 'hashmap.c', 'hashtable.c', 'json.c', 'library.c', 'log.c', 'main.c', 'md5.c', 'memory.c', 'mutex.c',
2222
'objectmap.c', 'path.c', 'pipe.c', 'pnacl.c', 'process.c', 'profile.c', 'radixsort.c', 'random.c', 'regex.c',
2323
'ringbuffer.c', 'sha.c', 'semaphore.c', 'stacktrace.c', 'stream.c', 'string.c', 'system.c', 'thread.c', 'time.c',
@@ -37,7 +37,7 @@
3737
test_lib = generator.lib(module = 'test', basepath = 'test', sources = ['test.c', 'test.m'], includepaths = includepaths)
3838

3939
test_cases = [
40-
'app', 'array', 'atomic', 'base64', 'beacon', 'bitbuffer', 'blowfish', 'bufferstream', 'config', 'environment', 'error',
40+
'app', 'array', 'atomic', 'base64', 'beacon', 'bitbuffer', 'blowfish', 'bufferstream', 'environment', 'error',
4141
'event', 'exception', 'fs', 'hash', 'hashmap', 'hashtable', 'json', 'library', 'math', 'md5', 'mutex', 'objectmap',
4242
'path', 'pipe', 'process', 'profile', 'radixsort', 'random', 'regex', 'ringbuffer', 'semaphore', 'sha', 'stacktrace',
4343
'stream', 'string', 'system', 'time', 'uuid'

‎foundation/config.c

-687
This file was deleted.

‎foundation/config.h

-199
This file was deleted.

‎foundation/environment.c

-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ environment_set_current_working_directory(const char* path, size_t length) {
378378
string_t buffer, pathstr;
379379
#endif
380380
bool result = true;
381-
log_debugf(0, STRING_CONST("Setting current working directory to: %.*s"), (int)length, path);
382381
#if FOUNDATION_PLATFORM_WINDOWS
383382
{
384383
wchar_t* wpath = wstring_allocate_from_string(path, length);

‎foundation/foundation.h

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ Wrapper for foundation library headers and main entry/exit points */
6060
#include <foundation/profile.h>
6161

6262
#include <foundation/environment.h>
63-
#include <foundation/config.h>
6463
#include <foundation/stream.h>
6564
#include <foundation/fs.h>
6665
#include <foundation/bufferstream.h>

‎foundation/fs.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1286,8 +1286,8 @@ _fs_monitor(void* monitorptr) {
12861286

12871287
#endif
12881288

1289-
log_debugf(0, STRING_CONST("Monitoring file system: %.*s"),
1290-
STRING_FORMAT(monitor->path));
1289+
//log_debugf(0, STRING_CONST("Monitoring file system: %.*s"),
1290+
// STRING_FORMAT(monitor->path));
12911291

12921292
#if FOUNDATION_PLATFORM_WINDOWS
12931293
{
@@ -1459,15 +1459,15 @@ _fs_monitor(void* monitorptr) {
14591459
// https://github.com/emcrisostomo/fswatch/blob/master/libfswatch/src/libfswatch/c%2B%2B/kqueue_monitor.cpp
14601460

14611461
#else
1462-
log_debug(0, STRING_CONST("Filesystem watcher not implemented on this platform"));
1462+
//log_debug(0, STRING_CONST("Filesystem watcher not implemented on this platform"));
14631463
//Not implemented yet, just wait for signal to simulate thread
14641464
thread_wait();
14651465
keep_running = false;
14661466
#endif
14671467
}
14681468

1469-
log_debugf(0, STRING_CONST("Stopped monitoring file system: %.*s"),
1470-
STRING_FORMAT(monitor->path));
1469+
//log_debugf(0, STRING_CONST("Stopped monitoring file system: %.*s"),
1470+
// STRING_FORMAT(monitor->path));
14711471

14721472
#if FOUNDATION_PLATFORM_WINDOWS
14731473

‎foundation/memory.c

-5
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ static bool _memory_tracker_initialized;
776776

777777
static int
778778
_memory_tracker_initialize(void) {
779-
log_debug(HASH_MEMORY, STRING_CONST("Initializing local memory tracker"));
780779
if (!_memory_tracker_initialized) {
781780
size_t size = sizeof(memory_tag_t) * _foundation_config.memory_tracker_max;
782781
_memory_tags = memory_allocate(0, size, 16, MEMORY_PERSISTENT | MEMORY_ZERO_INITIALIZED);
@@ -816,7 +815,6 @@ _memory_tracker_finalize(void) {
816815
unsigned int it;
817816
bool got_leaks = false;
818817

819-
log_debug(HASH_MEMORY, STRING_CONST("Checking for memory leaks"));
820818
for (it = 0; it < _foundation_config.memory_tracker_max; ++it) {
821819
memory_tag_t* tag = _memory_tags + it;
822820
if (atomic_loadptr(&tag->address)) {
@@ -830,9 +828,6 @@ _memory_tracker_finalize(void) {
830828
got_leaks = true;
831829
}
832830
}
833-
834-
if (!got_leaks)
835-
log_debug(HASH_MEMORY, STRING_CONST("No memory leaks detected"));
836831
}
837832
_memory_tracker_cleanup();
838833
}

‎foundation/platform.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,9 @@ typedef struct atomicptr_t atomicptr_t;
991991
#define STRING_FORMAT(s) (int)(s).length, (s).str
992992

993993
// Misc
994-
#if FOUNDATION_COMPILER_GCC || defined(__COVERITY__)
994+
#if defined(__COVERITY__)
995+
#define FOUNDATION_UNUSED(x) ((void)(x))
996+
#elif FOUNDATION_COMPILER_GCC
995997
#define FOUNDATION_UNUSED(x) ((void)sizeof((x)))
996998
#else
997999
#define FOUNDATION_UNUSED(x) (/*lint --e{505,550,818,866} */(void)sizeof((x), 0))

‎foundation/process.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ process_spawn(process_t* proc) {
249249
log_warn(0, WARNING_UNSUPPORTED, STRING_CONST("Unable to redirect standard in/out"
250250
" through pipes when using ShellExecute for process spawning"));
251251

252-
log_debugf(0, STRING_CONST("Spawn process (ShellExecute): %.*s %.*s"),
253-
STRING_FORMAT(proc->path), STRING_FORMAT(cmdline));
252+
//log_debugf(0, STRING_CONST("Spawn process (ShellExecute): %.*s %.*s"),
253+
// STRING_FORMAT(proc->path), STRING_FORMAT(cmdline));
254254

255255
if (!ShellExecuteExW(&sei)) {
256256
string_const_t errstr = system_error_message(0);
@@ -292,8 +292,8 @@ process_spawn(process_t* proc) {
292292
inherit_handles = TRUE;
293293
}
294294

295-
log_debugf(0, STRING_CONST("Spawn process (CreateProcess): %.*s %.*s"),
296-
STRING_FORMAT(proc->path), STRING_FORMAT(cmdline));
295+
//log_debugf(0, STRING_CONST("Spawn process (CreateProcess): %.*s %.*s"),
296+
// STRING_FORMAT(proc->path), STRING_FORMAT(cmdline));
297297

298298
if (!CreateProcessW(0, wcmdline, 0, 0, inherit_handles,
299299
(proc->flags & PROCESS_CONSOLE) ? CREATE_NEW_CONSOLE : 0, 0, wwd, &si, &pi)) {
@@ -365,7 +365,7 @@ process_spawn(process_t* proc) {
365365
params.application = fsref;
366366
params.argv = argvref;
367367

368-
log_debugf(0, STRING_CONST("Spawn process (LSOpenApplication): %.*s"), STRING_FORMAT(localpath));
368+
//log_debugf(0, STRING_CONST("Spawn process (LSOpenApplication): %.*s"), STRING_FORMAT(localpath));
369369

370370
status = LSOpenApplication(&params, &psn);
371371
if (status != 0) {
@@ -448,12 +448,12 @@ process_spawn(process_t* proc) {
448448
if (pid == 0) {
449449
//Child
450450
if (proc->wd.length) {
451-
log_debugf(0, STRING_CONST("Spawned child process, setting working directory to %.*s"),
452-
STRING_FORMAT(proc->wd));
451+
//log_debugf(0, STRING_CONST("Spawned child process, setting working directory to %.*s"),
452+
// STRING_FORMAT(proc->wd));
453453
environment_set_current_working_directory(STRING_ARGS(proc->wd));
454454
}
455455

456-
log_debugf(0, STRING_CONST("Child process executing: %.*s"), STRING_FORMAT(proc->path));
456+
//log_debugf(0, STRING_CONST("Child process executing: %.*s"), STRING_FORMAT(proc->path));
457457

458458
if (proc->flags & PROCESS_STDSTREAMS) {
459459
pipe_close_read(proc->pipeout);
@@ -478,7 +478,7 @@ process_spawn(process_t* proc) {
478478
memory_deallocate(argv);
479479

480480
if (pid > 0) {
481-
log_debugf(0, STRING_CONST("Child process forked, pid %d"), pid);
481+
//log_debugf(0, STRING_CONST("Child process forked, pid %d"), pid);
482482

483483
proc->pid = pid;
484484

‎foundation/profile.c

-2
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,6 @@ profile_initialize(const char* identifier, size_t length, void* buffer, size_t s
354354
thread_initialize(&_profile_io_thread, _profile_io, 0, STRING_CONST("profile_io"),
355355
THREAD_PRIORITY_BELOWNORMAL, 0);
356356

357-
log_debugf(0, STRING_CONST("Initialize profiling system with %u blocks (%" PRIsize "KiB)"),
358-
num_blocks, size / 1024);
359357
_profile_initialized = true;
360358
}
361359

‎foundation/thread.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ _thread_entry(thread_arg_t data) {
224224
pthread_set_name_np(pthread_self(), thread->name.str);
225225
#endif
226226

227-
log_debugf(0, STRING_CONST("Starting thread '%.*s' (%" PRIx64 ") %s"),
228-
STRING_FORMAT(thread->name), thread->osid,
229-
handler ? " (exceptions handled)" : "");
227+
//log_debugf(0, STRING_CONST("Starting thread '%.*s' (%" PRIx64 ") %s"),
228+
// STRING_FORMAT(thread->name), thread->osid,
229+
// handler ? " (exceptions handled)" : "");
230230

231231
set_thread_self(thread);
232232
atomic_store32(&thread->state, 1);
@@ -247,8 +247,8 @@ _thread_entry(thread_arg_t data) {
247247
}
248248
}
249249

250-
log_debugf(0, STRING_CONST("Exiting thread '%.*s' (%" PRIx64 ")"),
251-
STRING_FORMAT(thread->name), thread->osid);
250+
//log_debugf(0, STRING_CONST("Exiting thread '%.*s' (%" PRIx64 ")"),
251+
// STRING_FORMAT(thread->name), thread->osid);
252252

253253
if (thread_is_main())
254254
_thread_main_id = (uint64_t)-1;

‎foundation/uuid.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,8 @@ string_from_uuid(char* buffer, size_t size, const uuid_t val) {
174174
convert.raw.data4[2], convert.raw.data4[3], convert.raw.data4[4], convert.raw.data4[5],
175175
convert.raw.data4[6], convert.raw.data4[7]);
176176
if ((len < 0) || ((unsigned int)len > size)) {
177-
if (size)
178-
buffer[ size - 1 ] = 0;
179-
return (string_t) {buffer, size ? (size - 1) : 0};
177+
buffer[ size - 1 ] = 0;
178+
return (string_t) {buffer, size - 1};
180179
}
181180
return (string_t) {buffer, (unsigned int)len};
182181
}

‎test/config/main.c

-1,429
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.