Skip to content

llafuente/string.c

Repository files navigation

string.c

Single allocation string implementation (with struct) c99 at least, more convenient and performance that common null terminated char*, 100% compatible with them :) and accept multiple encodings.

It's not yet ready to be a shared library, use static instead. It's not stable enough.

Encodings

  • UTF8

  • UTF32be

  • UTF32le

  • ascii

  • binary

    Used for unknown or user data. Internally is handled as ascii (byte to byte)

Usage

include a single header

#include "stringc.h"

include .libs/ and link against libstringc.la

After usage you need to st_memfree some cache variable:

// cleaning caches
st_memfree();

API

stringc api

Compilation

autoconf is required.

RHEL

sudo yum install autoconf
sudo yum install libtool
sh autogen.sh
./configure
make

Tests

sh test.sh

Contibution

Just send a PR.

Style / format

We use clang-format to keep an uniform coding style, before PR always use:

sh format.sh

Documentation

We use cldoc + our formatter to output markdown.

sh doc.sh

Code-coverage

sh code-coverage.sh

Benchmarks

TODO

  • Use a variable in makefile.am?
  • new Phony target?

meanwhile... edit makefile.am

  • comment: test_run_tests_SOURCES = test/run-tests.c
  • uncomment: test_run_tests_SOURCES = test/run-benchmarks.c
sh benchmarks.sh oldversion
# do your changes and recompile
sh benchmarks.sh newversion
node compare.js oldversion newversion
# open with your browser bench_data/comparison.html

install pip & gcovr

install phyton...

cd /tmp
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo pip install gcovr

About

c string (struct) with multiple encodings (ascii, utf8, utf32)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published