Reuse, not rework

License Awareness

Highly Reusable Software

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Integer, Floating point, Matrix, Statistics, Boolean, ...

Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


librock_VSBInsert - make room and copy a block into a librock_VSB buffer
librock_VSBAppend - append a block onto the end of a librock_VSB buffer
#License - #Source code - #Example Use -


#include <librock/mstruct.h>

int librock_VSBInsert(
    struct librock_VSB_s *v,
    int loc,
    const char librock_PTR *buf,int len

int librock_VSBAppend(
    struct librock_VSB_s *v,
    const char librock_PTR *buf,int len


Moves existing data, reallocating the buffer if necessary, and copies in data. Returns number of characters added to the buffer, or 0 or -1 if could not.

The librock_VSB must not be WriteDisable'd.

Since a realloc is often required, any externally held pointers into the buffer are stale after these calls. This is a very common programmer error. If there is only one externally-held pointer, see librock_VSBDeleteAtPtr and librock_VSBInsertAtPtr.

Typical use is

#ifdef librock_TYPICAL_USE_VSBAppend
    struct librock_VSB_s *v = librock_VSBalloc();

    librock_VSBAppend(v,"is ",3);
    librock_VSBInsert(v,0,"this ",5);




    memcpy()   // #ifndef librock_memcpy
    memmove()  // #ifndef librock_memcpy

   //Uses macros for memory operations librock_memmove and librock_memcpy.
   //If not defined at compile time, set to memmove() and memcpy()


  Copyright 1998-2002 Forrest J. Cavalier III,
  Licensed under BSD-ish license, NO WARRANTY. Copies must retain this block.
  License text in <librock/license/librock.txt> librock_LIDESC_HC=12440211096131f5976d36be0cddca4cd9152e45

Source Code

./exec/struct/vsb.c (implementation, plus source of this manual page)

Tests and Supported Platform Types

This is a representative sample. Librock code is highly portable. For a particular platform not reported here, request paid support

librock_VSBAppend passed tests in tvsbop (Unix/Linux/BSD: 2002/08/08 sys=FreeBSD using gcc)
librock_VSBAppend passed tests in tvsbop_main (WIN32: 2002/08/08 sys=NT 4.0 using MSVC)
librock_VSBInsert passed tests in tvsbop (Unix/Linux/BSD: 2002/08/08 sys=FreeBSD using gcc)
librock_VSBInsert passed tests in tvsbop_main (WIN32: 2002/08/08 sys=NT 4.0 using MSVC)

This software is part of Librock

Rapid reuse, without rework. Details
This page copyright (C) 2002-2003 Forrest J. Cavalier III, d-b-a Mib Software, Saylorsburg PA 18353, USA

Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)

Want to help? We welcome comments, patches. -- Need help? Request paid support.