Sha256: bed1f36c8efe9bc022d572d0956917363509a54ea32565f30784316dd435d075

Contents?: true

Size: 1008 Bytes

Versions: 12

Compression:

Stored size: 1008 Bytes

Contents

#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "cstring.h"
#include "markdown.h"
#include "amalloc.h"


/* putc() into a cstring
 */
void
Csputc(int c, Cstring *iot)
{
    EXPAND(*iot) = c;
}


/* printf() into a cstring
 */
int
Csprintf(Cstring *iot, char *fmt, ...)
{
    va_list ptr;
    int siz=100;

    do {
	RESERVE(*iot, siz);
	va_start(ptr, fmt);
	siz = vsnprintf(T(*iot)+S(*iot), ALLOCATED(*iot)-S(*iot), fmt, ptr);
	va_end(ptr);
    } while ( siz > (ALLOCATED(*iot)-S(*iot)) );

    S(*iot) += siz;
    return siz;
}


/* write() into a cstring
 */
int
Cswrite(Cstring *iot, char *bfr, int size)
{
    RESERVE(*iot, size);
    memcpy(T(*iot)+S(*iot), bfr, size);
    S(*iot) += size;
    return size;
}


/* reparse() into a cstring
 */
void
Csreparse(Cstring *iot, char *buf, int size, int flags)
{
    MMIOT f;
    ___mkd_initmmiot(&f, 0);
    ___mkd_reparse(buf, size, 0, &f, 0);
    ___mkd_emblock(&f);
    SUFFIX(*iot, T(f.out), S(f.out));
    ___mkd_freemmiot(&f, 0);
}

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
rdiscountwl-1.0.0.2 ext/Csio.c
rdiscountwl-1.0.0.1 ext/Csio.c
rdiscount-2.2.0.2 ext/Csio.c
rdiscount-2.2.0.1 ext/Csio.c
rdiscount-2.2.0 ext/Csio.c
rdiscount-2.1.8 ext/Csio.c
rdiscount_wm-3.1.0.0 ext/Csio.c
rdiscount_wm-3.0.0.0 ext/Csio.c
rdiscount-2.1.7.1 ext/Csio.c
rdiscount-2.1.7 ext/Csio.c
challah-1.0.0 vendor/bundle/gems/rdiscount-2.1.6/ext/Csio.c
rdiscount-2.1.6 ext/Csio.c