aboutsummaryrefslogtreecommitdiffstats
path: root/src/symap.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/symap.h')
-rw-r--r--src/symap.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/symap.h b/src/symap.h
index ed74157..74dc59a 100644
--- a/src/symap.h
+++ b/src/symap.h
@@ -12,11 +12,14 @@
#ifndef SYMAP_H
#define SYMAP_H
+#include "zix/attributes.h"
+
#include <stdint.h>
typedef struct SymapImpl Symap;
/// Create a new symbol map
+ZIX_MALLOC_FUNC
Symap*
symap_new(void);
@@ -24,24 +27,18 @@ symap_new(void);
void
symap_free(Symap* map);
-/// Map a string to a symbol ID if it is already mapped, otherwise return 0
+/// Map a string to a symbol if it is already mapped, otherwise return 0
+ZIX_PURE_FUNC
uint32_t
-symap_try_map(Symap* map, const char* sym);
-
-/**
- Map a string to a symbol ID.
+symap_try_map(const Symap* map, const char* sym);
- Note that 0 is never a valid symbol ID.
-*/
+/// Map a string to a symbol
uint32_t
symap_map(Symap* map, const char* sym);
-/**
- Unmap a symbol ID back to a symbol, or NULL if no such ID exists.
-
- Note that 0 is never a valid symbol ID.
-*/
+/// Unmap a symbol back to a string if possible, otherwise return NULL
+ZIX_PURE_FUNC
const char*
-symap_unmap(Symap* map, uint32_t id);
+symap_unmap(const Symap* map, uint32_t id);
#endif // SYMAP_H