## Overview
[![License: BSD](https://img.shields.io/badge/License-BSD-blue.svg)](https://opensource.org/licenses/bsd-3-clause)
[![codecov](https://codecov.io/gh/tezc/sc/branch/master/graph/badge.svg?token=O8ZHQ0XZ30)](https://codecov.io/gh/tezc/sc)
Portable, stand-alone C libraries and data structures. (C99)
Each folder is stand-alone with a single header/source pair in it. There is no
build for libraries, just copy files you want.
e.g., If you want the logger, copy sc_log.h and sc_log.c to your project.
#### Features
- High performance & minimal memory usage
- Portability between many operating systems and architectures
- Tests with 100% branch coverage and multiple sanitizers
- Drag & drop source code distribution
### Test
There is 100% branch-coverage on Linux and CI runs on
<pre>
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)
</pre>
### List
| Library | Description |
|--------------------------------|---------------------------------------------------------------------------------------------|
| **[array](array)** | Generic array/vector |
| **[buffer](buffer)** | Buffer for encoding/decoding variables, best fit for protocol/serialization implementations |
| **[condition](condition)** | Condition wrapper for Posix and Windows |
| **[crc32](crc32)** | Crc32c, uses crc32c CPU instruction if available |
| **[heap](heap)** | Min heap which can be used as max heap/priority queue as well |
| **[ini](ini)** | Ini parser |
| **[linked list](linked-list)** | Intrusive linked list |
| **[logger](logger)** | Logger |
| **[map](map)** | A high performance open addressing hashmap |
| **[memory map](memory-map)** | Mmap wrapper for Posix and Windows |
| **[mutex](mutex)** | Mutex wrapper for Posix and Windows |
| **[option](option)** | Cmdline argument parser. Very basic one |
| **[perf](perf)** | Benchmark utility to get performance counters info via perf_event_open() |
| **[queue](queue)** | Generic queue which can be used as dequeue/stack/list as well |
| **[sc](sc)** | Utility functions |
| **[signal](signal)** | Signal safe snprintf & Signal handler (handling CTRL+C, printing backtrace on crash etc) |
| **[socket](socket)** | Pipe / tcp sockets(also unix domain sockets) /Epoll/Kqueue/WSAPoll for Posix and Windows |
| **[string](string)** | Length prefixed, null terminated C strings. |
| **[thread](thread)** | Thread wrapper for Posix and Windows. |
| **[time](time)** | Time and sleep functions for Posix and Windows |
| **[timer](timer)** | Hashed timing wheel implementation with fast poll / cancel ops |
| **[uri](uri)** | A basic uri parser |
-
#### Q&A
-----
* **Is it any better than library X ?**
I often use these libraries for high performance server-side applications. Also,
I care about readable and easy to debug code. In summary, these libraries show
my taste(trade-offs) about performance/api-design/readability. You may or may
not like it.
* **Why don't you change API here at X, so it will be easier to use?**
Send a pull request please but be sure you don't introduce an undefined
behavior. It's possible to provide better APIs, especially to generic libraries,
if you don't care about undefined behaviors. I try to avoid it.
* **What is the most efficient way to use these libraries?**
Just like any other code. Add to your project as source files and ideally use
-O3 -flto + PGO. It may not make any difference for your use case though.
* **Is library X being used in any product?**
Some libraries are used in the production but please always test yourself.
* **Is there any release?**
Please use the master branch. It's considered stable.
* **Will you keep API stable?**
Please don't expect a stable API. These libraries are quite
small (most of them are less than a few hundreds lines of code) and ideally you
are supposed to read the code and understand what it does and adapt it to your
needs. So, you should not update libraries blindly. I expect you to handle
any possible API differences easily. That being said, I'll do my best to keep
API stable.
没有合适的资源?快使用搜索试试~ 我知道了~
Common libraries and data structures for C..zip
共148个文件
c:63个
txt:23个
md:23个
需积分: 5 0 下载量 106 浏览量
2023-12-31
11:12:24
上传
评论
收藏 200KB ZIP 举报
温馨提示
Common libraries and data structures for C.
资源推荐
资源详情
资源评论
收起资源包目录
Common libraries and data structures for C..zip (148个子文件)
map_test.c 57KB
sock_test.c 46KB
sc_sock.c 44KB
sc_map.c 24KB
buf_test.c 15KB
sc_buf.c 15KB
str_test.c 14KB
sc_signal.c 12KB
ini_test.c 12KB
sc_crc32.c 12KB
log_test.c 9KB
sc_log.c 9KB
uri_test.c 9KB
sc_str.c 8KB
sc_mmap.c 7KB
mmap_test.c 7KB
cond_test.c 6KB
array_test.c 6KB
timer_test.c 6KB
sc_perf.c 6KB
sc_uri.c 5KB
sc_test.c 5KB
sc_timer.c 5KB
heap_test.c 5KB
queue_test.c 5KB
signal_test.c 5KB
sc.c 4KB
sc_ini.c 4KB
sc_cond.c 4KB
sc_time.c 4KB
sc_list.c 4KB
list_test.c 4KB
sc_thread.c 4KB
sc_heap.c 3KB
option_test.c 3KB
sc_mutex.c 3KB
mutex_test.c 3KB
sc_option.c 2KB
thread_test.c 2KB
time_test.c 2KB
timer_example.c 2KB
map_example.c 1KB
crc32_test.c 1KB
ini_example.c 927B
log_example.c 918B
queue_example.c 912B
heap_example.c 907B
option_example.c 801B
buf_example.c 771B
array_example.c 713B
uri_example.c 653B
list_example.c 588B
str_example.c 474B
mmap_example.c 437B
crc32_example.c 367B
cond_example.c 326B
perf_example.c 300B
thread_example.c 264B
mutex_example.c 179B
time_example.c 178B
signal_example.c 54B
sock_example.c 31B
sc_example.c 30B
.clang-format 3KB
.gitattributes 23B
.gitignore 459B
sc_sock.h 12KB
sc_buf.h 11KB
sc_map.h 11KB
sc_queue.h 11KB
sc_array.h 8KB
sc_perf.h 8KB
sc_list.h 7KB
sc_str.h 7KB
sc_log.h 5KB
sc_timer.h 4KB
sc_mmap.h 4KB
sc_signal.h 4KB
sc_uri.h 3KB
sc.h 3KB
sc_heap.h 3KB
sc_ini.h 3KB
sc_thread.h 3KB
sc_cond.h 3KB
sc_mutex.h 2KB
sc_option.h 2KB
sc_time.h 2KB
sc_crc32.h 2KB
LICENSE 1KB
README.md 6KB
README.md 3KB
README.md 3KB
README.md 2KB
README.md 2KB
README.md 2KB
README.md 2KB
README.md 2KB
README.md 1KB
README.md 1KB
README.md 1KB
共 148 条
- 1
- 2
资源评论
暮苍梧~
- 粉丝: 41
- 资源: 258
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功