lkml.org 
[lkml]   [2014]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/8] perf, tools: Add jsmn `jasmine' JSON parser
On Wed, Mar 05, 2014 at 11:49:31AM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>

SNIP

> +/* Return line number of a jsmn token */
> +int json_line(char *map, jsmntok_t *t)
> +{
> + return countchar(map, '\n', t->start) + 1;
> +}
> +
> +static const char *jsmn_types[] = {
> + [JSMN_PRIMITIVE] = "primitive",
> + [JSMN_ARRAY] = "array",
> + [JSMN_OBJECT] = "object",
> + [JSMN_STRING] = "string"
> +};
> +
> +#define NELE(x) (sizeof(x) / sizeof(*(x)))

use ARRAY_SIZE

jirka


\
 
 \ /
  Last update: 2014-03-11 15:21    [W:0.127 / U:0.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site