aboutsummaryrefslogtreecommitdiff
path: root/src/include/better_string.h
blob: 4fc43150af52e6ad79b923d8ebb6dbf888e82fd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef STRING_H
#define STRING_H

#include <stdlib.h>
#include <stdbool.h>
#define DEFAULT_STR_SIZE 10

typedef struct {
  char *buf;
  size_t len;
  size_t size;
} string_t;

string_t *init_string(const char *source);

string_t *string_copy(string_t *s);

char *string_copy_raw(string_t *s);

void string_push(string_t *s, char c);

void string_concat(string_t *s1, string_t *s2);

void string_concat_const(string_t *s, const char *src);

char string_pop(string_t *s);

bool string_cmp(string_t *s1, string_t *s2);

void string_free(void *s);

#endif