aboutsummaryrefslogtreecommitdiff
path: root/buffer.h
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2025-12-05 12:05:32 -0700
committerRandy Palamar <randy@rnpnr.xyz>2025-12-16 11:28:44 -0700
commit1d1d19ed30309b39fc5e43c830cabb4cdd004d07 (patch)
tree56bb7c09d3b07118e39e7fc6174403b0235d56a7 /buffer.h
parent65dd46e0bba74948c824370a06e509cba462cd72 (diff)
downloadvis-1d1d19ed30309b39fc5e43c830cabb4cdd004d07.tar.gz
vis-1d1d19ed30309b39fc5e43c830cabb4cdd004d07.tar.xz
mark all functions in headers with VIS_EXPORT or VIS_INTERNAL
if vis actually wants to be a library exported symbols may need mark up depending on the platform (eg. __declspec(dllexport)). This needs to be hidden behind a macro because the way you export is not the same on every platform. I did this based on the assumption that vis.h was supposed to be the only interface to the "vis" library. Since nobody actually uses vis as a library I have no idea if this is actually correct. Anyway marking up all prototypes like this allows for one to convert all functions to static if a single translation unit is used by inserting at the start: #define VIS_INTERNAL static #define VIS_EXPORT static
Diffstat (limited to 'buffer.h')
-rw-r--r--buffer.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/buffer.h b/buffer.h
index 1c30a0e..66e8d4d 100644
--- a/buffer.h
+++ b/buffer.h
@@ -21,36 +21,36 @@ typedef struct {
} Buffer;
/** Release all resources, reinitialize buffer. */
-void buffer_release(Buffer*);
+VIS_INTERNAL void buffer_release(Buffer*);
/** Reserve space to store at least ``size`` bytes.*/
-bool buffer_reserve(Buffer*, size_t size);
+VIS_INTERNAL bool buffer_reserve(Buffer*, size_t size);
/** Reserve space for at least ``len`` *more* bytes. */
-bool buffer_grow(Buffer*, size_t len);
+VIS_INTERNAL bool buffer_grow(Buffer*, size_t len);
/** If buffer is non-empty, make sure it is ``NUL`` terminated. */
-bool buffer_terminate(Buffer*);
+VIS_INTERNAL bool buffer_terminate(Buffer*);
/** Set buffer content, growing the buffer as needed. */
-bool buffer_put(Buffer*, const void *data, size_t len);
+VIS_INTERNAL bool buffer_put(Buffer*, const void *data, size_t len);
/** Set buffer content to ``NUL`` terminated data. */
-bool buffer_put0(Buffer*, const char *data);
+VIS_INTERNAL bool buffer_put0(Buffer*, const char *data);
/** Remove ``len`` bytes starting at ``pos``. */
-bool buffer_remove(Buffer*, size_t pos, size_t len);
+VIS_INTERNAL bool buffer_remove(Buffer*, size_t pos, size_t len);
/** Insert NUL-terminated data at pos. */
-bool buffer_insert0(Buffer*, size_t pos, const char *data);
+VIS_INTERNAL bool buffer_insert0(Buffer*, size_t pos, const char *data);
/** Append further content to the end. */
-bool buffer_append(Buffer*, const void *data, size_t len);
+VIS_INTERNAL bool buffer_append(Buffer*, const void *data, size_t len);
/** Append NUL-terminated data. */
-bool buffer_append0(Buffer*, const char *data);
+VIS_INTERNAL bool buffer_append0(Buffer*, const char *data);
/** Append formatted buffer content, ensures NUL termination on success. */
-bool buffer_appendf(Buffer*, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
+VIS_INTERNAL bool buffer_appendf(Buffer*, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
/** Return length of a buffer without trailing NUL byte. */
-size_t buffer_length0(Buffer*);
+VIS_INTERNAL size_t buffer_length0(Buffer*);
/**
* Get pointer to buffer data.
* Guaranteed to return a NUL terminated string even if buffer is empty.
*/
-const char *buffer_content0(Buffer*);
+VIS_INTERNAL const char *buffer_content0(Buffer*);
/** ``read(3p)`` like interface for reading into a Buffer (``context``) */
-ssize_t read_into_buffer(void *context, char *data, size_t len);
+VIS_INTERNAL ssize_t read_into_buffer(void *context, char *data, size_t len);
#endif