Merge branch '1.0' into HEAD
authorPetri Lehtinen <petri@digip.org>
Tue, 8 Sep 2009 14:02:39 +0000 (17:02 +0300)
committerPetri Lehtinen <petri@digip.org>
Tue, 8 Sep 2009 14:02:39 +0000 (17:02 +0300)
Conflicts:
configure.ac
doc/conf.py

1  2 
configure.ac
doc/conf.py
src/Makefile.am
src/load.c

diff --combined configure.ac
@@@ -1,5 -1,5 +1,5 @@@
  AC_PREREQ([2.63])
- AC_INIT([jansson], [1.0.1+], [petri@digip.org])
 -AC_INIT([jansson], [1.0.2], [petri@digip.org])
++AC_INIT([jansson], [1.0.2+], [petri@digip.org])
  
  AM_INIT_AUTOMAKE([1.10 foreign])
  
diff --combined doc/conf.py
@@@ -52,7 -52,7 +52,7 @@@ copyright = u'2009, Petri Lehtinen
  # The short X.Y version.
  version = '1.0'
  # The full version, including alpha/beta/rc tags.
- release = '1.0.1+'
 -release = '1.0.2'
++release = '1.0.2+'
  
  # The language for content autogenerated by Sphinx. Refer to documentation
  # for a list of supported languages.
diff --combined src/Makefile.am
@@@ -13,6 -13,6 +13,6 @@@ libjansson_la_SOURCES = 
        utf.h \
        util.h \
        value.c
- libjansson_la_LDFLAGS = -version-info 0:1:0
+ libjansson_la_LDFLAGS = -version-info 0:2:0
  
 -AM_CFLAGS = -Wall -Wextra -Werror -std=c99
 +AM_CFLAGS = -Wall -Wextra -Werror
diff --combined src/load.c
@@@ -12,6 -12,7 +12,6 @@@
  #include <stdlib.h>
  #include <string.h>
  #include <stdarg.h>
 -#include <unistd.h>
  #include <assert.h>
  
  #include <jansson.h>
@@@ -133,10 -134,7 +133,7 @@@ static char stream_get(stream_t *stream
  
          c = stream->buffer[0];
  
-         if(c == EOF && stream->eof(stream->data))
-             return EOF;
-         if(c < 0)
+         if(c < 0 && c != EOF)
          {
              /* multi-byte UTF-8 sequence */
              int i, count;
@@@ -256,11 -254,11 +253,11 @@@ static void lex_scan_string(lex_t *lex
      lex->value.string = NULL;
      lex->token = TOKEN_INVALID;
  
-     /* skip the " */
      c = lex_get_save(lex, error);
  
      while(c != '"') {
          if(c == EOF) {
+             lex_unget_unsave(lex, c);
              if(lex_eof(lex))
                  error_set(error, lex, "premature end of input");
              goto out;
@@@ -543,17 -541,6 +540,17 @@@ out
      return lex->token;
  }
  
 +static char *lex_steal_string(lex_t *lex)
 +{
 +    char *result = NULL;
 +    if(lex->token == TOKEN_STRING)
 +    {
 +        result = lex->value.string;
 +        lex->value.string = NULL;
 +    }
 +    return result;
 +}
 +
  static int lex_init(lex_t *lex, get_func get, eof_func eof, void *data)
  {
      stream_init(&lex->stream, get, eof, data);
@@@ -597,7 -584,7 +594,7 @@@ static json_t *parse_object(lex_t *lex
              goto error;
          }
  
 -        key = strdup(lex->value.string);
 +        key = lex_steal_string(lex);
          if(!key)
              return NULL;