Comment code
This commit is contained in:
1 parent
91ebd7cc9f
commit
352e0972cd
1 file changed
+5
-3
+5
-3
@@ -66,20 +66,22 @@
|
|||||||
#define STRING_FAILURE ((size_t)-1)
|
#define STRING_FAILURE ((size_t)-1)
|
||||||
|
|
||||||
/* This is the main structure of this module. */
|
/* This is the main structure of this module. */
|
||||||
|
|
||||||
|
// string if it is heap allocated
|
||||||
typedef struct {
|
typedef struct {
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t alloc;
|
size_t alloc;
|
||||||
} str_heap_t;
|
} str_heap_t;
|
||||||
|
// string if it is stack allocated
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char buffer[sizeof (str_heap_t)];
|
char buffer[sizeof (str_heap_t)];
|
||||||
} str_stack_t;
|
} str_stack_t;
|
||||||
|
// both cases of string are possible
|
||||||
typedef union {
|
typedef union {
|
||||||
str_heap_t heap;
|
str_heap_t heap;
|
||||||
str_stack_t stack;
|
str_stack_t stack;
|
||||||
} str_union_t;
|
} str_union_t;
|
||||||
|
// main structure
|
||||||
typedef struct {
|
typedef struct {
|
||||||
str_union_t u;
|
str_union_t u;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|||||||
Reference in new issue
Block a user