3 * Null codec implementation
5 * (c) 2009 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of the mLib utilities library.
12 * mLib is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Library General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
17 * mLib is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with mLib; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28 /*----- Header files ------------------------------------------------------*/
35 /*----- Data structures ---------------------------------------------------*/
37 typedef struct null_codec {
41 /*----- Main code ---------------------------------------------------------*/
43 static int encdec(codec *c, const void *p, size_t sz, dstr *d)
44 { DPUTM(d, p, sz); return (0); }
46 static void destroy(codec *c)
47 { null_codec *nc = (null_codec *)c; DESTROY(nc); }
49 static const codec_ops ops = { &null_codec_class, encdec, destroy };
51 static codec *encoder(unsigned flags, const char *indent, unsigned maxlen)
60 static codec *decoder(unsigned flags)
69 const codec_class null_codec_class = { "null", encoder, decoder };
71 /*----- That's all, folks -------------------------------------------------*/