sc ships twenty-two C99 libraries as header and source pairs you copy in, with no stable API promised
Common libraries and data structures for C.
At a glance
- What is it?
- sc is a BSD-3-Clause collection of portable C99 libraries and data structures by tezc, where each folder holds one header and one source file. There is no build step for the libraries, no stable API guarantee, and the author tells you to track master instead of releases.
- Who is it for?
- Take sc when you write C on Linux, macOS, FreeBSD or Windows and want a small hashmap, queue, timer wheel or socket wrapper you can read in one sitting and copy straight into your tree. Look elsewhere if you need a frozen API, versioned releases or a package manager entry.
- Can I use it commercially?
- Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 131 days ago.
- What is it written in?
- Mainly C, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- tezc/sc2,579 ★ · +8
| Repository | 2026-10-08 | 2026-11-25 |
|---|---|---|
| tezc/sc | 2.6k | 2.6k |
8 Stars in the last 48 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Each folder is one header and one source file, and installing means copying them
The unit of distribution in sc is the folder. Every library sits in its own directory with a single header and a single source file in it, and the README states there is no build for the libraries. You copy the files you want. Its own example: to use the logger, copy sc_log.h and sc_log.c into your project.
That gives the repository a flat layout. The top level lists array/, buffer/, condition/, crc32/, disjoint/, heap/, ini/, linked-list/, logger/, map/, memory-map/, mutex/, option/, perf/, queue/, sc/, signal/, socket/, string/, thread/, time/, timer/ and uri/. A CMakeLists.txt, a codecov.yml and a .clang-format file sit beside them, and those serve the repository's own tests and style, not your integration.
The cost of drag and drop distribution is that you own the copy. Nothing tells you when the upstream file changes, and there is no package manifest to pin. A library that depends on another, such as a module using the sc utility functions, needs you to copy that dependency too, so open the header you want and read its includes before you copy. The code is C99, which a current compiler on any of the listed systems accepts.
The CI matrix spans four operating systems, three compilers and seven architectures, but coverage is measured on Linux
The project's strongest claim is its test setup. There is 100 percent branch coverage on Linux, and CI runs across these dimensions:
OS : Linux, MacOS, FreeBSD and Windows
Compilers : GCC, Clang, MSVC
Arch : x64, aarch64, armv6(32 bit), armv7(32 bit), ppc64le, s390x(big endian), riscv64
Sanitizers : valgrind and clang/gcc sanitizers(address, undefined, thread)The architecture list includes a big-endian machine, s390x, which is where code that casts bytes to integers tends to break. Two 32-bit ARM variants cover pointer-size assumptions. Address, undefined and thread sanitizers cover memory errors, undefined behavior and data races, and valgrind adds a second view of memory use.
Read the coverage claim carefully. The 100 percent figure is stated for Linux. The Windows, macOS and FreeBSD jobs run the same tests, but the statement does not say that branches reached only on those systems are counted, so code under Windows-specific paths such as the Windows halves of the mutex, thread and socket wrappers may be exercised without the same measured guarantee. If you ship on Windows, run the tests there.
Master is the release, and the tags stop at v1.0.4 in March 2021
The Q&A answers the release question in one line: use the master branch, which is considered stable. The tagged releases on GitHub are v1.0.2 (2021-02-19), v1.0.3 (2021-02-27) and v1.0.4 (2021-03-23). The last push to the repository was on 2026-07-18, so the tags are more than five years behind the code. The repository is not archived.
The practical rule follows directly. Copy from master at a commit you record, not from a tag. A tag from 2021 misses everything since, and the author does not treat tags as the supported channel.
The API question gets a frank answer too. Do not expect a stable API. The libraries are small, most under a few hundred lines, and you are meant to read the code, understand it and adapt it. You should not update libraries blindly, and the author expects you to handle API differences yourself, while saying they will do their best to keep the API stable. Put the two statements together and the contract is best effort with no promise. For a long-lived product, treat each copied file as vendored code that you maintain from the day you paste it.
Mutex, thread, condition, time and memory map wrap Posix and Windows behind one header
A cluster of libraries exists to hide the split between Posix and Windows. The mutex library is a mutex wrapper for both. The thread library wraps threads for both. The condition library is a condition wrapper for both. The time library offers time and sleep functions for both, and memory-map wraps mmap for both.
The socket library does the largest job of the group. It covers pipes, TCP sockets and unix domain sockets, plus an event layer built on Epoll, Kqueue and WSAPoll, which are the Linux, BSD or macOS, and Windows mechanisms for waiting on many descriptors. One header and one source file therefore carry a cross-platform event loop foundation for a server.
The use case is clear: a C program that must build on Linux and Windows without pulling in a large portability layer. The limit is equally clear. Each wrapper is thin and small, so it exposes the common subset of what the platforms offer. If you need a platform-specific feature, such as a particular thread attribute, you write that part yourself or edit the copied file, which the vendored layout allows.
The map is an open addressing hashmap, and the queue doubles as deque, stack and list
The data structures are the part most projects will copy first. The map is described as a high performance open addressing hashmap. The array is a generic array or vector. The queue is generic and, according to the table, can be used as a deque, a stack or a list as well. The heap is a min heap that also works as a max heap or priority queue. The linked list is intrusive, meaning the link fields live inside your own structs. The disjoint library is a disjoint set, also called union-find, with amortized fast search. The string library gives length-prefixed, null-terminated C strings.
The timer library is a hashed timing wheel with fast poll and cancel operations, which suits a server that tracks many timeouts.
There is no tree among them. A reader looking for a binary search tree, an AVL tree or a trie will not find one in the list, so the heap and the hashmap are the ordered and keyed structures on offer. The heap gives you order by priority and the map gives you lookup by key, and a sorted iteration over keys is not provided by either.
Logger, signal and perf help a server debug itself, and the parsers are labeled basic
Several libraries serve a long-running process. The logger is a plain logger. The signal library offers a signal-safe snprintf and a signal handler that deals with CTRL+C and prints a backtrace on crash. The perf library is a benchmark utility that reads performance counters through perf_event_open(). The buffer library encodes and decodes variables and is described as the best fit for protocol and serialization implementations. The crc32 library computes Crc32c and uses the crc32c CPU instruction when available.
The three parsers are modest by the author's own labels. The option library is a cmdline argument parser, and the README adds that it is a very basic one. The uri library is a basic uri parser. The ini library is an ini parser. If you need long option grouping, subcommands or full RFC conformance in URI handling, these are starting points, not finished tools.
A signal-safe snprintf matters because ordinary formatting functions are unsafe inside signal handlers, so a crash handler that prints a backtrace needs its own. It is the sort of detail that shows the libraries were extracted from server work.
The author calls the libraries a matter of taste and avoids undefined behavior
The Q&A begins with the question of whether these are better than another library. The answer is modest: the author uses them for high performance server-side applications, cares about readable and easy to debug code, and says the libraries show personal taste about the tradeoffs between performance, API design and readability. You may or may not like it.
On API changes, the author invites a pull request but asks that it introduce no undefined behavior. A friendlier API is possible, especially in the generic libraries, if undefined behavior is ignored, and the author tries to avoid it. That is a design constraint with a cost: some APIs stay more awkward than they could be.
For speed, the advice is to add the libraries as source files and ideally compile with -O3, -flto and profile-guided optimization, while noting it may not make any difference for your use case. On production use, the answer is that some libraries are used in production, but you should always test yourself. No library is named as used, and no user count is given.
Editorial conclusion
Take sc when you write C on Linux, macOS, FreeBSD or Windows and want a small hashmap, queue, timer wheel or socket wrapper you can read in one sitting and copy straight into your tree. Look elsewhere if you need a frozen API, versioned releases or a package manager entry. Before copying anything, read the one file you want, pin the commit you took it from, and run your own tests against it.
Frequently asked questions
What is a library in C, as in sc?
In sc, each library is a folder holding a single header and source pair, such as sc_log.h and sc_log.c for the logger. There is no build step, and you copy the files into your project.
What data structures in C does sc include?
It includes a generic array, queue, min heap, intrusive linked list, open addressing hashmap, disjoint set and hashed timing wheel, plus length-prefixed strings.
Does sc include a tree data structure?
No tree appears in its list of libraries. The ordered and keyed structures it offers are the heap, which works as a priority queue, and the hashmap.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/tezc-sc)Star history chart for your README
[](https://hysenlabs.com/projects/tezc-sc)Was this useful?