• Stars
    star
    425
  • Rank 102,094 (Top 3 %)
  • Language
    C
  • License
    Other
  • Created over 13 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A ring buffer implemented in C

WHAT

c-ringbuf is a simple ring buffer implementation in C.

It includes support for read(2) and write(2) operations on ring buffers, memcpy's into and out of ring buffers, setting the buffer contents to a constant value, and copies between ring buffers. It also supports searching for single characters, for use with line-oriented or character-delimited network protocols.

It should be fairly straightforward to extend c-ringbuf to support other C library operations that operate on buffers, e.g., recv(2).

WHY

I implemented c-ringbuf because I needed a simple, dependency-free ring buffer type for use with network services written in C.

INSTALLING

c-ringbuf is not a library as such, so it doesn't need to be installed. Just copy the ringbuf.[ch] source files into your project. (Also see LICENSE below.)

c-ringbuf has no dependencies beyond an ISO C90 standard library.

Note that ringbuf.c contains several assert() statements. These are intended for use with the test harness (see below), and should probably be removed from production code, once you're confident that c-ringbuf works as intended.

This distribution includes source for a test program executable (ringbuf-test.c), which runs extensive unit tests on the c-ringbuf implementation. On most platforms (other than Windows, which is not supported), you should be able to type make to run the unit tests. Note that the Makefile uses the clang C compiler by default, but also has support for gcc -- just edit the Makefile so that it uses gcc instead of clang.

The Makefile also includes targets for gcov coverage testing and valgrind memory testing, assuming you have those tools installed on your system.

LICENSE

c-ringbuf has no license; it is dedicated to the public domain. See the file COPYING, included in this distribution, for the specifics.

CONTRIBUTING

If you would like to make a pull request (PR) or other contribution to this project, please see CONTRIBUTING.md for details on how to do that.

CONTACT

Drew Hess [email protected]

https://drewhess.com/

More Repositories

1

rabbit-scheme

Guy Steele's RABBIT Scheme compiler
58
star
2

nixos-yubikey

Create NixOS ISO images for use with initializing Yubikeys
Nix
30
star
3

hpio

Perform GPIO from Haskell
Haskell
21
star
4

echoev

echo client and server written using libev
C
21
star
5

sicp-solutions

My solutions to exercises in the 2nd edition of Abelson and Sussman's SICP
Scheme
20
star
6

lobbyists

Parsers and utilities for the Senate LD-1/LD-2 database.
Python
16
star
7

contacts

Sorry, I'm no longer maintaining this software. Please have a look at the various forks.
Objective-C
13
star
8

applescripts

AppleScripts that I've written or modified
11
star
9

automator

Automator workflows that I've written or modified
6
star
10

nixpkgs-lib-quixoftic

An overlay of useful Nix functions
Nix
5
star
11

dhess-nix

This project is no longer active. Please see https://github.com/hackworthltd/hacknix
Nix
5
star
12

pinpon

A doorbell service in Haskell. No, really.
Haskell
4
star
13

c-logging

A syslog-compatible stderr logging mechanism
C
3
star
14

mellon

Control physical access device (e.g., an electric strike) from Haskell
Haskell
3
star
15

dhess-lib-nix

This project is no longer active. Please see https://github.com/hackworthltd/hacknix-lib
Nix
3
star
16

nixpkgs-dhess

My personal Nixpkgs overlay
Nix
2
star
17

luup-egg

A Chicken Scheme extension for controlling MiOS home automation gateways
Scheme
2
star
18

posix-extras-egg

Additional POSIX functionality not included in Chicken Scheme's posix unit
Scheme
2
star
19

dhess.github.com

I am Jack's empty web page
2
star
20

nix-darwin-dhess

My personal nix-darwin modules
Nix
1
star
21

fm-assistant

A crude tool to automate FM mod installation
Haskell
1
star
22

quixops-modules

Useful modules for NixOps deployments
Nix
1
star