source: lib/json_util.h @ 67ebc8e

Last change on this file since 67ebc8e was 67ebc8e, checked in by Wilmer van der Gaast <wilmer@…>, at 2012-11-12T00:03:33Z

Fixed valgrind warnings in JSON_O_FOREACH.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/***************************************************************************\
2*                                                                           *
3*  BitlBee - An IRC to IM gateway                                           *
4*  Helper functions for json.c                                              *
5*                                                                           *
6*  Copyright 2012 Wilmer van der Gaast <wilmer@gaast.net>                   *
7*                                                                           *
8*  This library is free software; you can redistribute it and/or            *
9*  modify it under the terms of the GNU Lesser General Public               *
10*  License as published by the Free Software Foundation, version            *
11*  2.1.                                                                     *
12*                                                                           *
13*  This library is distributed in the hope that it will be useful,          *
14*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
15*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
16*  Lesser General Public License for more details.                          *
17*                                                                           *
18*  You should have received a copy of the GNU Lesser General Public License *
19*  along with this library; if not, write to the Free Software Foundation,  *
20*  Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA           *
21*                                                                           *
22****************************************************************************/
23
24#include "json.h"
25
26#define JSON_O_FOREACH(o, k, v) \
27        char *k; json_value *v; int __i; \
28        for( __i = 0; ( __i < (o)->u.object.length ) && \
29                      ( k = (o)->u.object.values[__i].name ) && \
30                      ( v = (o)->u.object.values[__i].value ); \
31                      __i ++ )
32
33json_value *json_o_get( const json_value *obj, const json_char *name );
34const char *json_o_str( const json_value *obj, const json_char *name );
35char *json_o_strdup( const json_value *obj, const json_char *name );
Note: See TracBrowser for help on using the repository browser.