diff options
| author | Tyge Løvset <[email protected]> | 2022-03-26 16:21:39 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-03-26 16:21:39 +0100 |
| commit | 920a55280a28ce38b98045f797067e285395bb6e (patch) | |
| tree | d3afd64cf8ae1270324c82391bafbd9413e49749 /include/stc/alt | |
| parent | f943c8b7a6e46dc002ffc63c9fbcc111f6dca55d (diff) | |
| download | STC-modified-920a55280a28ce38b98045f797067e285395bb6e.tar.gz STC-modified-920a55280a28ce38b98045f797067e285395bb6e.zip | |
Fixed alt/cstr.h (short string optimized), so that it can be used in containers. Had to change some API in csview to make it play with that.
Diffstat (limited to 'include/stc/alt')
| -rw-r--r-- | include/stc/alt/cstr.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/include/stc/alt/cstr.h b/include/stc/alt/cstr.h index 82ebae91..211e169a 100644 --- a/include/stc/alt/cstr.h +++ b/include/stc/alt/cstr.h @@ -26,21 +26,16 @@ */
#ifndef CSTR_H_INCLUDED
#define CSTR_H_INCLUDED
+#define CSTR_IS_SSO
#include <stc/ccommon.h>
+#include <stc/forward.h>
#include <stdlib.h> /* malloc */
#include <string.h>
#include <stdarg.h>
#include <stdio.h> /* vsnprintf */
#include <ctype.h>
-typedef struct { char* data; size_t size, cap; } _cstr_rep_t;
-
-typedef union {
- struct { char data[sizeof(_cstr_rep_t) - 1], cap_len; } sso;
- struct { char* data; size_t size, ncap; } lon;
-} cstr;
-
/**************************** PRIVATE API **********************************/
enum { SSO_CAP = sizeof(_cstr_rep_t) - 1 };
|
