O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
constructors_destructors.c
1/* ************************************************************************** */
2/* ____ _ _____ ____ _ _ _ _____ _ _ ____ ____ */
3/* / ___| / \ | ___| _ \ / \ | \ | | |_ _| || | | _ \/ ___| */
4/* \___ \ / _ \ | |_ | |_) | / _ \ | \| | | | | || |_| | | \___ \ */
5/* ___) / ___ \| _| | _ < / ___ \| |\ | | | |__ _| |_| |___) | */
6/* |____/_/ \_|_| |_| \_/_/ \_|_| \_| |_| |_| |____/|____/ */
7/* */
8/* Copyright 2023, SAFRAN T4DS, ALL RIGHTS RESERVED */
9/* */
10/* @file constructors_destructors.c */
11/* @author Antoine GAGNIERE */
12/* */
13/* ************************************************************************** */
14
15#include "o2s/string.h"
16
19{
20 return ArrayNew(char);
21}
22
24string_t string_from(const char* cstring, size_t length)
25{
26 string_t result = string_new();
27
28 string_append_cstring(&result, cstring, length);
29 return result;
30}
31
33void string_clear(string_t* self)
34{
35 array_clear(self);
36}
void array_clear(array_t *self)
Clears properly the array.
#define ArrayNew(Type)
Convenient constructor wrapper.
Definition array.h:38
Dynamic string implementation.
string_t string_new(void)
Constructs an empty string.
array_t string_t
A string is an array of char.
Definition string.h:30