Commit graph

35 commits

Author SHA1 Message Date
8c96fd8d7d Begin the great StrDuplicate() refactor. 2023-02-23 23:19:23 +00:00
46fe667988 Add HashMapGetKey() so we can free bucket keys before deleting them. 2023-02-17 03:14:43 +00:00
b8ce4c9239 Lock database in DbExists() to prevent race conditions. 2023-01-09 19:25:49 +00:00
30c3690287 Renamed String.h to Str.h because Windows is dumb. 2023-01-08 04:38:06 +00:00
08b36c071c Begin prototyping User.h 2023-01-07 15:51:56 +00:00
0a29aa7f5a Move string related functions to a new String API.
I think we have accumulated enough string functions that they should
have their own API. This shortens the function names a bit too.
2023-01-07 04:33:32 +00:00
2ce09f8632 Convert UtilStringConcat() into a varargs function.
This allows us to concatenate an arbitrary amount of strings without
having to maintain a bunch of pointers or leak memory when nesting calls.
2023-01-07 03:17:06 +00:00
1282371680 Fix "bad pointer" warnings. 2023-01-06 18:50:31 +00:00
fbd7bf5944 Fix memory leak in DbDelete() 2022-12-28 15:44:21 +00:00
3c8d89a52e Update copyright year 2022-12-26 15:52:52 +00:00
7ee31ad36b Copy diagram from scrap paper into code for clarity. 2022-12-15 22:14:16 +00:00
449851a67e Format code 2022-12-15 20:31:51 +00:00
bee07d90fc Fix memory leaks in database. 2022-12-15 20:29:19 +00:00
cc6ae2dbd3 Prevent directory traversals by replacing dots and slashes. 2022-12-15 16:07:45 +00:00
c8cd2cebb7 Implement DbDelete() 2022-12-15 02:39:58 +00:00
7544a97c7d Format source code, add .exrc 2022-11-23 14:56:31 +00:00
520b062dbb Should probably make sure this succeeds. 2022-11-23 00:44:29 +00:00
b155d0dbe4 ftruncate() technically lives in unistd.h
It should be included to prevent warnings on some compilers.
2022-11-22 22:31:36 +00:00
7f883fc92e Remove debugging statements... whoops!
I'm usually pretty good about this.
2022-11-21 21:09:05 +00:00
973e826e57 Fix bug in floating objects to mostRecent 2022-11-21 21:07:40 +00:00
40e5c1ef2a Fix some bugs in DbCreate() regarding UtilMkdir() 2022-11-21 20:59:22 +00:00
789baf33a1 Make Db interfaces take varargs.
This makes it much more flexible, at the expense of making it a little
more fragile. I can think of a number of scenarios where we'll have
paths that have variables in multiple spots, and I don't want to do
sprintf() magic every time I need to access an object at one of those
paths.
2022-11-21 20:31:37 +00:00
0c6c1e5b19 Notify the user about the minimum max-cache instead of silently setting it. 2022-11-21 16:22:50 +00:00
cd584c1e93 Lock objects on disk if they're locked in memory.
This requires hanging onto an open file handle, and doesn't require
explicit unlocking, because POSIX says files are unlocked when their
descriptors are closed.
2022-11-21 16:13:11 +00:00
07f4ecd2d7 Make a number of improvements to cache handling.
- Items that are too big for the cache are now no longer immediately
  evicted; everything else is. This is probably not desirable, but it is
  not unexpected.
- Multithreading now should work as expected; DbRefs are locked before
  they are updated from the disk, and they are not evicted from the cache
  if they are locked by another thread.
- The cache may be no smaller than 1024 bytes. Previously the caller of
  DbOpen() could choose to disable the cache, and provisions were made in
  the code to support this, but this is now no longer possible because
  without the cache, there would be no way to know what files were open,
  which could lead to a race condition if two threads open the same file.
2022-11-18 22:17:56 +00:00
045c6d8644 Cache eviction 2022-11-18 20:42:08 +00:00
e7ad166877 Fix some memory leaks in Db 2022-11-18 19:36:15 +00:00
2e6c129263 Fix a mutex bug in Db and some memory errors in Json 2022-11-17 23:51:45 +00:00
d26fad4619 Add UtilMkdir() to recursively make directories 2022-11-17 22:57:29 +00:00
46cc1df385 Do some Db work 2022-11-15 18:20:05 +00:00
a356403cfd Finish DbComputeSize() 2022-11-12 18:26:31 +00:00
efbbf42a6e Fix memory and connection closing errors. 2022-11-08 01:05:28 +00:00
37ee7700f4 Start writing a function to compute the in-memory size of an object. 2022-11-06 00:47:17 +00:00
fd50fd83fb Misc changes throughout the codebase during testing. 2022-10-31 08:12:42 -04:00
e009536065 Begin prototyping persistent storage API 2022-10-24 12:44:29 -04:00