Skip to content
No description, website, or topics provided.
C Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
src
tests
.gitignore
AUTHORS
COPYING
ChangeLog
INSTALL
LICENSE
Makefile.am
NEWS
README
README.md
autogen.sh
configure.ac

README.md

#lib-mutablestring

A MutableString object is a memory managed byte string whose buffer pointer always contains a NULL byte at the end. While it is called string, it is actually a byte array storing the length in bytes. It's possible to use it to store NULL bytes, and you'll still get a NULL byte at the end of it.

What is it?

Libmutable string provides a data structure called MutableString. The library provides useful functions for manipulating and creating strings.

typedef struct MutableString {
    size_t length;
    size_t capacity;
    char*  buffer;
} MutableString;

Example

/**
 * This program creates a string.
 */
int main(void)
{
  MutableString* ms;
  ms = mutable_string_new(NULL); // allocate a new mutable string instance, but `buffer` isn't allocated yet.
  
  mutable_string_append(ms, "This is a string");
  mutable_string_append_c(ms, '.');
  mutable_string_append_c(ms, '\n');
  
  mutable_string_dump(stdout, ms);
  
  mutable_string_free(ms);
  
  return 0;
}

Installation

The default install prefix is /usr/local specify your path with ./configure --prefix=$HOME

Unit Tests

It's tested. Currently every public function of the library is unit tested. Almost as much time went into to developing the library as time went into testing it.

You can’t perform that action at this time.