{"id":13521401,"url":"https://github.com/tezc/sc","last_synced_at":"2025-05-14T04:09:35.940Z","repository":{"id":37613693,"uuid":"311798324","full_name":"tezc/sc","owner":"tezc","description":"Common libraries and data structures for C.","archived":false,"fork":false,"pushed_at":"2025-02-15T09:24:54.000Z","size":835,"stargazers_count":2455,"open_issues_count":3,"forks_count":280,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-04-11T00:44:28.182Z","etag":null,"topics":["algorithm","algorithms","c","collections","data-structures","generic","hashmap","hashtable","heap","library","linked-list","logger","priority-queue","queue","socket","stack","thread","timer","vector"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tezc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-10T22:18:50.000Z","updated_at":"2025-04-10T02:09:34.000Z","dependencies_parsed_at":"2023-12-21T10:01:49.721Z","dependency_job_id":"739b7d76-cbb5-40a7-af17-facf8e26c98b","html_url":"https://github.com/tezc/sc","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tezc%2Fsc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tezc%2Fsc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tezc%2Fsc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tezc%2Fsc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tezc","download_url":"https://codeload.github.com/tezc/sc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254070107,"owners_count":22009559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","algorithms","c","collections","data-structures","generic","hashmap","hashtable","heap","library","linked-list","logger","priority-queue","queue","socket","stack","thread","timer","vector"],"created_at":"2024-08-01T06:00:33.940Z","updated_at":"2025-05-14T04:09:30.919Z","avatar_url":"https://github.com/tezc.png","language":"C","readme":"## Overview\n\n[![License: BSD](https://img.shields.io/badge/License-BSD-blue.svg)](https://opensource.org/licenses/bsd-3-clause)\n[![codecov](https://codecov.io/gh/tezc/sc/branch/master/graph/badge.svg?token=O8ZHQ0XZ30)](https://codecov.io/gh/tezc/sc)\n\nPortable, stand-alone C libraries and data structures. (C99)\n\nEach folder is stand-alone with a single header/source pair in it. There is no  \nbuild for libraries, just copy files you want. \n\ne.g., If you want the logger, copy sc_log.h and sc_log.c to your project.\n\n#### Features\n\n- High performance \u0026 minimal memory usage\n- Portability between many operating systems and architectures\n- Tests with 100% branch coverage and multiple sanitizers\n- Drag \u0026 drop source code distribution\n\n### Test\nThere is 100% branch-coverage on Linux and CI runs on\n\n\u003cpre\u003e\nOS         : Linux, MacOS, FreeBSD and Windows  \nCompilers  : GCC, Clang, MSVC  \nArch       : x64, aarch64, armv6(32 bit), armv7(32 bit), ppc64le, s390x(big endian), riscv64  \nSanitizers : valgrind and clang/gcc sanitizers(address, undefined, thread)\n\u003c/pre\u003e\n\n### List\n\n| Library                        | Description                                                                                 |\n|--------------------------------|---------------------------------------------------------------------------------------------|\n| **[array](array)**             | Generic array/vector                                                                        |\n| **[buffer](buffer)**           | Buffer for encoding/decoding variables, best fit for protocol/serialization implementations |\n| **[condition](condition)**     | Condition wrapper for Posix and Windows                                                     |\n| **[crc32](crc32)**             | Crc32c, uses crc32c CPU instruction if available                                            |\n| **[heap](heap)**               | Min heap which can be used as max heap/priority queue as well                               | \n| **[ini](ini)**                 | Ini parser                                                                                  |\n| **[linked list](linked-list)** | Intrusive linked list                                                                       |\n| **[logger](logger)**           | Logger                                                                                      |\n| **[map](map)**                 | A high performance open addressing hashmap                                                  |\n| **[memory map](memory-map)**   | Mmap wrapper for Posix and Windows                                                          |\n| **[mutex](mutex)**             | Mutex wrapper for Posix and Windows                                                         |\n| **[option](option)**           | Cmdline argument parser. Very basic one                                                     |\n| **[perf](perf)**               | Benchmark utility to get performance counters info via perf_event_open()                    | \n| **[queue](queue)**             | Generic queue which can be used as dequeue/stack/list as well                               |\n| **[sc](sc)**                   | Utility functions                                                                           |\n| **[signal](signal)**           | Signal safe snprintf \u0026 Signal handler (handling CTRL+C, printing backtrace on crash etc)    |\n| **[socket](socket)**           | Pipe / tcp sockets(also unix domain sockets) /Epoll/Kqueue/WSAPoll for Posix and Windows    |\n| **[string](string)**           | Length prefixed, null terminated C strings.                                                 |\n| **[thread](thread)**           | Thread wrapper for Posix and Windows.                                                       |\n| **[time](time)**               | Time and sleep functions for Posix and Windows                                              |\n| **[timer](timer)**             | Hashed timing wheel implementation with fast poll / cancel ops                              |\n| **[uri](uri)**                 | A basic uri parser                                                                          |\n  \n-\n\n#### Q\u0026A\n\n-----\n* **Is it any better than library X ?**  \n  I often use these libraries for high performance server-side applications. Also,  \n  I care about readable and easy to debug code. In summary, these libraries show  \n  my taste(trade-offs) about performance/api-design/readability. You may or may  \n  not like it.\n\n\n* **Why don't you change API here at X, so it will be easier to use?**  \n  Send a pull request please but be sure you don't introduce an undefined  \n  behavior. It's possible to provide better APIs, especially to generic libraries,  \n  if you don't care about undefined behaviors. I try to avoid it.\n\n\n* **What is the most efficient way to use these libraries?**  \n  Just like any other code. Add to your project as source files and ideally use   \n  -O3 -flto + PGO. It may not make any difference for your use case though.\n\n\n* **Is library X being used in any product?**  \n  Some libraries are used in the production but please always test yourself.\n\n\n* **Is there any release?**   \n  Please use the master branch. It's considered stable.\n\n\n* **Will you keep API stable?**   \n  Please don't expect a stable API. These libraries are quite  \n  small (most of them are less than a few hundreds lines of code) and ideally you  \n  are supposed to read the code and understand what it does and adapt it to your   \n  needs. So, you should not update libraries blindly. I expect you to handle  \n  any possible API differences easily. That being said, I'll do my best to keep  \n  API stable.","funding_links":[],"categories":["Frameworks","C","框架","Common","Members"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftezc%2Fsc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftezc%2Fsc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftezc%2Fsc/lists"}