Git Product home page Git Product logo

c-ringbuf's Introduction

WHAT

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 ringbuf to support other C library operations that operate on buffers, e.g., recv(2).

WHY

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

INSTALLING

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.)

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 ringbuf works as intended.

This distribution includes source for a test program executable (ringbuf-test.c), which runs extensive unit tests on the 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

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

CONTACT

Drew Hess <[email protected]>

http://drewhess.com/

c-ringbuf's People

Contributors

dhess avatar trutest avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.