Example #1
0
static void Log_p(KonohaContext *kctx, KonohaStack *sfp, int pos, KUtilsWriteBuffer *wb, int level)
{
	kRawPtr *self = (kRawPtr *) sfp[0].asObject;
	struct Log *log = (struct Log *) self->rawptr;
	int i;
	char *data = log_get_data(log);
	uint16_t klen, vlen;
	KLIB Kwb_printf(kctx, wb, "{");
	for (i = 0; i < log->logsize; ++i) {
		char kbuf[64] = {};
		char vbuf[64] = {};
		char *next = log_iterator(log, data, i);
		klen = log_get_length(log, i*2+0);
		vlen = log_get_length(log, i*2+1);
		memcpy(kbuf, data,klen);
		memcpy(vbuf, data+klen, vlen);
		KLIB Kwb_printf(kctx, wb, "'%s': '%s' ", kbuf, vbuf);
		data = next;
	}
	KLIB Kwb_printf(kctx, wb, "}");
}
Example #2
0
static void Log_p(CTX, ksfp_t *sfp, int pos, kwb_t *wb)
{
	kRawPtr *self = (kRawPtr *) sfp[0].asObject;
	struct Log *log = (struct Log *) self->rawptr;
	int i;
	char *data = log_get_data(log);
	uint16_t klen, vlen;
	kwb_printf(wb, "{");
	for (i = 0; i < log->logsize; ++i) {
		char kbuf[64] = {};
		char vbuf[64] = {};
		char *next = log_iterator(log, data, i);
		klen = log_get_length(log, i*2+0);
		vlen = log_get_length(log, i*2+1);
		memcpy(kbuf, data,klen);
		memcpy(vbuf, data+klen, vlen);
		kwb_printf(wb, "'%s': '%s' ", kbuf, vbuf);
		data = next;
	}
	kwb_printf(wb, "}");
}