aboutsummaryrefslogtreecommitdiff
path: root/include/std
diff options
context:
space:
mode:
Diffstat (limited to 'include/std')
-rw-r--r--include/std/buffer.h2
-rw-r--r--include/std/buffer_view.h2
-rw-r--r--include/std/hash_map.h1
-rw-r--r--include/std/log.h2
-rw-r--r--include/std/mem.h2
-rw-r--r--include/std/misc.h8
-rw-r--r--include/std/thread.h4
7 files changed, 14 insertions, 7 deletions
diff --git a/include/std/buffer.h b/include/std/buffer.h
index d194881..3c2d79c 100644
--- a/include/std/buffer.h
+++ b/include/std/buffer.h
@@ -32,6 +32,8 @@ void* buffer_get(Buffer *self, usize index, usize type_size);
CHECK_RESULT int buffer_pop(Buffer *self, void *data, usize size);
/* Set buffer size to 0, doesn't change the capacity */
void buffer_clear(Buffer *self);
+/* Also changes size if @new_capacity is less than buffer size */
+CHECK_RESULT int buffer_set_capacity(Buffer *self, usize new_capacity);
void* buffer_begin(Buffer *self);
void* buffer_end(Buffer *self);
usize __buffer_get_size(Buffer *self, usize type_size);
diff --git a/include/std/buffer_view.h b/include/std/buffer_view.h
index 59a97d3..9c0a722 100644
--- a/include/std/buffer_view.h
+++ b/include/std/buffer_view.h
@@ -8,7 +8,7 @@ typedef struct {
usize size;
} BufferView;
-BufferView create_buffer_view_null();
+BufferView create_buffer_view_null(void);
BufferView create_buffer_view(const char *data, usize size);
bool buffer_view_equals(const BufferView *self, const BufferView *other);
diff --git a/include/std/hash_map.h b/include/std/hash_map.h
index c9e5b51..05755ce 100644
--- a/include/std/hash_map.h
+++ b/include/std/hash_map.h
@@ -35,6 +35,7 @@ CHECK_RESULT int hash_map_insert(HashMap *self, BufferView key, void *value);
If @value is NULL, then the value is not copied and the functions works the same as @hash_map_contains
*/
CHECK_RESULT bool hash_map_get(HashMap *self, BufferView key, void *value);
+CHECK_RESULT bool hash_map_get_ref(HashMap *self, BufferView key, void **value);
CHECK_RESULT bool hash_map_contains(HashMap *self, BufferView key);
int hash_map_compare_string(const void *a, const void *b);
diff --git a/include/std/log.h b/include/std/log.h
index cd376c6..12b52e1 100644
--- a/include/std/log.h
+++ b/include/std/log.h
@@ -3,7 +3,7 @@
#include "defs.h"
-amal_mutex* amal_log_get_mutex();
+amal_mutex* amal_log_get_mutex(void);
void amal_log_debug(const char *fmt, ...);
void amal_log_error(const char *fmt, ...);
void amal_log_info(const char *fmt, ...);
diff --git a/include/std/mem.h b/include/std/mem.h
index 2afce0d..1cc06bf 100644
--- a/include/std/mem.h
+++ b/include/std/mem.h
@@ -9,6 +9,6 @@ int am_memcmp(const void *lhs, const void *rhs, usize size);
bool am_memeql(const void *lhs, const void *rhs, usize size);
void am_memset(void *dest, int value, usize size);
-long am_pagesize();
+long am_pagesize(void);
#endif
diff --git a/include/std/misc.h b/include/std/misc.h
index e89f1eb..a9bd5b6 100644
--- a/include/std/misc.h
+++ b/include/std/misc.h
@@ -21,8 +21,7 @@
#define return_if_error(result) \
do { \
- int return_if_result; \
- return_if_result = (result); \
+ int return_if_result = (result); \
if(return_if_result != 0) { \
return_if_debug_msg; \
return return_if_result; \
@@ -31,6 +30,11 @@
#define cleanup_if_error(result) do { if((result) != 0) { cleanup_if_debug_msg; goto cleanup; } } while(0)
+typedef struct {
+ int result;
+ void *data;
+} ResultMem;
+
#if defined(__GNUC__) && __GNUC__ >= 4
#define CHECK_RESULT __attribute__ ((warn_unused_result))
#elif defined(_MSC_VER) && _MSC_VER >= 1700
diff --git a/include/std/thread.h b/include/std/thread.h
index 2765204..ae8fe39 100644
--- a/include/std/thread.h
+++ b/include/std/thread.h
@@ -43,9 +43,9 @@ CHECK_RESULT int amal_thread_deinit(amal_thread *self);
CHECK_RESULT int amal_thread_detach(amal_thread *self);
CHECK_RESULT int amal_thread_join(amal_thread *self, void **result);
-bool amal_thread_is_main();
+bool amal_thread_is_main(void);
/* Returns 0 if the number of usable threads is unknown */
-int amal_get_usable_thread_count();
+int amal_get_usable_thread_count(void);
CHECK_RESULT int amal_mutex_init(amal_mutex *self);
void amal_mutex_deinit(amal_mutex *self);