[前][次][番号順一覧][スレッド一覧]

ruby-changes:6654

From: nobu <ko1@a...>
Date: Wed, 23 Jul 2008 03:02:29 +0900 (JST)
Subject: [ruby-changes:6654] Ruby:r18170 (trunk): * ext/syck: suppress warnings.

nobu	2008-07-23 03:02:12 +0900 (Wed, 23 Jul 2008)

  New Revision: 18170

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18170

  Log:
    * ext/syck: suppress warnings.

  Modified files:
    trunk/ChangeLog
    trunk/ext/syck/emitter.c
    trunk/ext/syck/implicit.c
    trunk/ext/syck/rubyext.c
    trunk/ext/syck/syck.c
    trunk/ext/syck/syck.h
    trunk/ext/syck/token.c
    trunk/ext/syck/yaml2byte.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18169)
+++ ChangeLog	(revision 18170)
@@ -1,3 +1,7 @@
+Wed Jul 23 03:02:08 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/syck: suppress warnings.
+
 Wed Jul 23 00:34:20 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/openssl: suppress warnings.
Index: ext/syck/rubyext.c
===================================================================
--- ext/syck/rubyext.c	(revision 18169)
+++ ext/syck/rubyext.c	(revision 18170)
@@ -71,7 +71,7 @@
  * handler prototypes
  */
 SYMID rb_syck_load_handler _((SyckParser *, SyckNode *));
-void rb_syck_err_handler _((SyckParser *, char *));
+void rb_syck_err_handler _((SyckParser *, const char *));
 SyckNode * rb_syck_bad_anchor_handler _((SyckParser *, char *));
 void rb_syck_output_handler _((SyckEmitter *, char *, long));
 void rb_syck_emitter_handler _((SyckEmitter *, st_data_t));
@@ -103,7 +103,8 @@
     int taint;
     char *ret;
     VALUE bc;
-    bytestring_t *sav; 
+    bytestring_t *sav;
+    void *data;
 
     SyckParser *parser = syck_new_parser();
     taint = syck_parser_assign_io(parser, &port);
@@ -112,7 +113,7 @@
     syck_parser_implicit_typing( parser, 0 );
     syck_parser_taguri_expansion( parser, 0 );
     oid = syck_parse( parser );
-    syck_lookup_sym( parser, oid, &sav );
+    if (syck_lookup_sym( parser, oid, &data )) sav = data;
 
     ret = S_ALLOCA_N( char, strlen( sav->buffer ) + 3 );
     ret[0] = '\0';
@@ -634,7 +635,7 @@
  * friendly errors.
  */
 void
-rb_syck_err_handler(SyckParser *p, char *msg)
+rb_syck_err_handler(SyckParser *p, const char *msg)
 {
     char *endl = p->cursor;
 
@@ -1189,7 +1190,7 @@
 VALUE
 syck_defaultresolver_detect_implicit(VALUE self, VALUE val)
 {
-    char *type_id;
+    const char *type_id;
     VALUE tmp = rb_check_string_type(val);
 
     if ( !NIL_P(tmp) )
Index: ext/syck/yaml2byte.c
===================================================================
--- ext/syck/yaml2byte.c	(revision 18169)
+++ ext/syck/yaml2byte.c	(revision 18170)
@@ -128,6 +128,7 @@
     char *finish;
     bytestring_t *val = NULL;
     bytestring_t *sav = NULL;
+    void *data;
     /*TRACE0("syck_yaml2byte_handler()");*/
     val = bytestring_alloc();
     if(n->anchor) bytestring_append(val,YAMLBYTE_ANCHOR, n->anchor, NULL);
@@ -188,7 +189,7 @@
             for ( i = 0; i < n->data.list->idx; i++ )
             {
                 oid = syck_seq_read( n, i );
-                syck_lookup_sym( p, oid, &sav );
+                if (syck_lookup_sym( p, oid, &data )) sav = data;
                 bytestring_extend(val, sav);
             }
             bytestring_append(val,YAMLBYTE_END_BRANCH,NULL,NULL);
@@ -198,10 +199,10 @@
             for ( i = 0; i < n->data.pairs->idx; i++ )
             {
                 oid = syck_map_read( n, map_key, i );
-                syck_lookup_sym( p, oid, &sav );
+                if (syck_lookup_sym( p, oid, &data )) sav = data;
                 bytestring_extend(val, sav);
                 oid = syck_map_read( n, map_value, i );
-                syck_lookup_sym( p, oid, &sav );
+                if (syck_lookup_sym( p, oid, &data )) sav = data;
                 bytestring_extend(val, sav);
             }
             bytestring_append(val,YAMLBYTE_END_BRANCH,NULL,NULL);
@@ -217,7 +218,8 @@
 {
     SYMID oid;
     char *ret;
-    bytestring_t *sav; 
+    bytestring_t *sav;
+    void *data;
 
     SyckParser *parser = syck_new_parser();
     syck_parser_str_auto( parser, yamlstr, NULL );
@@ -227,7 +229,8 @@
     syck_parser_taguri_expansion( parser, 1 );
     oid = syck_parse( parser );
 
-    if ( syck_lookup_sym( parser, oid, &sav ) == 1 ) {
+    if ( syck_lookup_sym( parser, oid, &data ) ) {
+	sav = data;
         ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 );
         ret[0] = '\0';
         strcat( ret, "D\n" );
Index: ext/syck/syck.c
===================================================================
--- ext/syck/syck.c	(revision 18169)
+++ ext/syck/syck.c	(revision 18170)
@@ -177,7 +177,7 @@
 }
 
 int
-syck_add_sym( SyckParser *p, char *data )
+syck_add_sym( SyckParser *p, void *data )
 {
     SYMID id = 0;
     if ( p->syms == NULL )
@@ -190,10 +190,14 @@
 }
 
 int
-syck_lookup_sym( SyckParser *p, SYMID id, void *data )
+syck_lookup_sym( SyckParser *p, SYMID id, void **datap )
 {
+    st_data_t data = (st_data_t)*datap;
+    int ret;
     if ( p->syms == NULL ) return 0;
-    return st_lookup( p->syms, id, data );
+    ret = st_lookup( p->syms, id, &data );
+    *datap = (void *)data;
+    return ret;
 }
 
 int
@@ -493,7 +497,7 @@
 }
 
 void
-syck_default_error_handler( SyckParser *p, char *msg )
+syck_default_error_handler( SyckParser *p, const char *msg )
 {
     printf( "Error at [Line %d, Col %d]: %s\n", 
         p->linect,
Index: ext/syck/emitter.c
===================================================================
--- ext/syck/emitter.c	(revision 18169)
+++ ext/syck/emitter.c	(revision 18170)
@@ -538,7 +538,7 @@
  * Basic printable test for LATIN-1 characters.
  */
 int
-syck_scan_scalar( int req_width, char *cursor, long len )
+syck_scan_scalar( int req_width, const char *cursor, long len )
 {
     long i = 0, start = 0;
     int flags = SCAN_NONE;
@@ -638,13 +638,14 @@
  * All scalars should be emitted through this function, which determines an appropriate style,
  * tag and indent.
  */
-void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style, int force_indent, int force_width,
-                       char keep_nl, char *str, long len )
+void syck_emit_scalar( SyckEmitter *e, const char *tag, enum scalar_style force_style, int force_indent, int force_width,
+                       char keep_nl, const char *str, long len )
 {
     enum scalar_style favor_style = scalar_literal;
     SyckLevel *parent = syck_emitter_parent_level( e );
     SyckLevel *lvl = syck_emitter_current_level( e );
     int scan = 0;
+    const char *match_implicit;
     char *implicit;
     
     if ( str == NULL ) str = "";
@@ -658,10 +659,10 @@
     }
 
     scan = syck_scan_scalar( force_width, str, len );
-    implicit = syck_match_implicit( str, len );
+    match_implicit = syck_match_implicit( str, len );
 
     /* quote strings which default to implicits */
-    implicit = syck_taguri( YAML_DOMAIN, implicit, strlen( implicit ) );
+    implicit = syck_taguri( YAML_DOMAIN, match_implicit, strlen( match_implicit ) );
     if ( syck_tagcmp( tag, implicit ) != 0 && syck_tagcmp( tag, "tag:yaml.org,2002:str" ) == 0 ) {
         force_style = scalar_2quote;
     } else {
@@ -772,7 +773,7 @@
 }
 
 void
-syck_emitter_escape( SyckEmitter *e, char *src, long len )
+syck_emitter_escape( SyckEmitter *e, const char *src, long len )
 {
     int i;
     for( i = 0; i < len; i++ )
@@ -801,12 +802,13 @@
 /*
  * Outputs a single-quoted block.
  */
-void syck_emit_1quoted( SyckEmitter *e, int width, char *str, long len )
+void
+syck_emit_1quoted( SyckEmitter *e, int width, const char *str, long len )
 {
     char do_indent = 0;
-    char *mark = str;
-    char *start = str;
-    char *end = str;
+    const char *mark = str;
+    const char *start = str;
+    const char *end = str;
     syck_emitter_write( e, "'", 1 );
     while ( mark < str + len ) {
         if ( do_indent ) {
@@ -848,12 +850,13 @@
 /*
  * Outputs a double-quoted block.
  */
-void syck_emit_2quoted( SyckEmitter *e, int width, char *str, long len )
+void
+syck_emit_2quoted( SyckEmitter *e, int width, const char *str, long len )
 {
     char do_indent = 0;
-    char *mark = str;
-    char *start = str;
-    char *end = str;
+    const char *mark = str;
+    const char *start = str;
+    const char *end = str;
     syck_emitter_write( e, "\"", 1 );
     while ( mark < str + len ) {
         if ( do_indent > 0 ) {
@@ -908,11 +911,12 @@
 /*
  * Outputs a literal block.
  */
-void syck_emit_literal( SyckEmitter *e, char keep_nl, char *str, long len )
+void
+syck_emit_literal( SyckEmitter *e, char keep_nl, const char *str, long len )
 {
-    char *mark = str;
-    char *start = str;
-    char *end = str;
+    const char *mark = str;
+    const char *start = str;
+    const char *end = str;
     syck_emitter_write( e, "|", 1 );
     if ( keep_nl == NL_CHOMP ) {
         syck_emitter_write( e, "-", 1 );
@@ -943,11 +947,12 @@
 /*
  * Outputs a folded block.
  */
-void syck_emit_folded( SyckEmitter *e, int width, char keep_nl, char *str, long len )
+void
+syck_emit_folded( SyckEmitter *e, int width, char keep_nl, const char *str, long len )
 {
-    char *mark = str;
-    char *start = str;
-    char *end = str;
+    const char *mark = str;
+    const char *start = str;
+    const char *end = str;
     syck_emitter_write( e, ">", 1 );
     if ( keep_nl == NL_CHOMP ) {
         syck_emitter_write( e, "-", 1 );
@@ -992,7 +997,7 @@
 /*
  * Begins emission of a sequence.
  */
-void syck_emit_seq( SyckEmitter *e, char *tag, enum seq_style style )
+void syck_emit_seq( SyckEmitter *e, const char *tag, enum seq_style style )
 {
     SyckLevel *parent = syck_emitter_parent_level( e );
     SyckLevel *lvl = syck_emitter_current_level( e );
@@ -1013,7 +1018,8 @@
 /*
  * Begins emission of a mapping.
  */
-void syck_emit_map( SyckEmitter *e, char *tag, enum map_style style )
+void
+syck_emit_map( SyckEmitter *e, const char *tag, enum map_style style )
 {
     SyckLevel *parent = syck_emitter_parent_level( e );
     SyckLevel *lvl = syck_emitter_current_level( e );
Index: ext/syck/implicit.c
===================================================================
--- ext/syck/implicit.c	(revision 18169)
+++ ext/syck/implicit.c	(revision 18170)
@@ -20,7 +20,7 @@
 void
 try_tag_implicit( SyckNode *n, int taguri )
 {
-    char *tid = "";
+    const char *tid = "";
     switch ( n->kind )
     {
         case syck_str_kind:
@@ -44,9 +44,10 @@
     }
 }
 
-char *syck_match_implicit( char *str, size_t len )
+const char *
+syck_match_implicit( const char *str, size_t len )
 {
-    char *cursor, *limit, *marker;
+    const char *cursor, *limit, *marker;
     cursor = str;
     limit = str + len;
 
Index: ext/syck/syck.h
===================================================================
--- ext/syck/syck.h	(revision 18169)
+++ ext/syck/syck.h	(revision 18170)
@@ -155,7 +155,7 @@
 typedef struct _syck_level SyckLevel;
 
 typedef SYMID (*SyckNodeHandler)(SyckParser *, SyckNode *);
-typedef void (*SyckErrorHandler)(SyckParser *, char *);
+typedef void (*SyckErrorHandler)(SyckParser *, const char *);
 typedef SyckNode * (*SyckBadAnchorHandler)(SyckParser *, char *);
 typedef long (*SyckIoFileRead)(char *, SyckIoFile *, long, long); 
 typedef long (*SyckIoStrRead)(char *, SyckIoStr *, long, long);
@@ -348,12 +348,12 @@
 char *syck_xprivate( char *, int );
 char *syck_taguri( const char *, const char *, int );
 int syck_tagcmp( const char *, const char * );
-int syck_add_sym( SyckParser *, char * );
-int syck_lookup_sym( SyckParser *, SYMID, void * );
+int syck_add_sym( SyckParser *, void * );
+int syck_lookup_sym( SyckParser *, SYMID, void ** );
 int syck_try_implicit( SyckNode * );
 char *syck_type_id_to_uri( char * );
 void try_tag_implicit( SyckNode *, int );
-char *syck_match_implicit( char *, size_t );
+const char *syck_match_implicit( const char *, size_t );
 
 /*
  * API prototypes
@@ -371,17 +371,17 @@
 void syck_free_emitter( SyckEmitter * );
 void syck_emitter_clear( SyckEmitter * );
 void syck_emitter_write( SyckEmitter *, const char *, long );
-void syck_emitter_escape( SyckEmitter *, char *, long );
+void syck_emitter_escape( SyckEmitter *, const char *, long );
 void syck_emitter_flush( SyckEmitter *, long );
 void syck_emit( SyckEmitter *, st_data_t );
-void syck_emit_scalar( SyckEmitter *, char *, enum scalar_style, int, int, char, char *, long );
-void syck_emit_1quoted( SyckEmitter *, int, char *, long );
-void syck_emit_2quoted( SyckEmitter *, int, char *, long );
-void syck_emit_folded( SyckEmitter *, int, char, char *, long );
-void syck_emit_literal( SyckEmitter *, char, char *, long );
-void syck_emit_seq( SyckEmitter *, char *, enum seq_style );
+void syck_emit_scalar( SyckEmitter *, const char *, enum scalar_style, int, int, char, const char *, long );
+void syck_emit_1quoted( SyckEmitter *, int, const char *, long );
+void syck_emit_2quoted( SyckEmitter *, int, const char *, long );
+void syck_emit_folded( SyckEmitter *, int, char, const char *, long );
+void syck_emit_literal( SyckEmitter *, char, const char *, long );
+void syck_emit_seq( SyckEmitter *, const char *, enum seq_style );
 void syck_emit_item( SyckEmitter *, st_data_t );
-void syck_emit_map( SyckEmitter *, char *, enum map_style );
+void syck_emit_map( SyckEmitter *, const char *, enum map_style );
 void syck_emit_end( SyckEmitter * );
 void syck_emit_tag( SyckEmitter *, const char *, const char * );
 void syck_emit_indent( SyckEmitter * );
@@ -395,7 +395,7 @@
 void syck_parser_set_root_on_error( SyckParser *, SYMID );
 void syck_parser_implicit_typing( SyckParser *, int );
 void syck_parser_taguri_expansion( SyckParser *, int );
-int syck_scan_scalar( int, char *, long );
+int syck_scan_scalar( int, const char *, long );
 void syck_parser_handler( SyckParser *, SyckNodeHandler );
 void syck_parser_error_handler( SyckParser *, SyckErrorHandler );
 void syck_parser_bad_anchor_handler( SyckParser *, SyckBadAnchorHandler );
@@ -410,7 +410,7 @@
 long syck_parser_read( SyckParser * );
 long syck_parser_readlen( SyckParser *, long );
 SYMID syck_parse( SyckParser * );
-void syck_default_error_handler( SyckParser *, char * );
+void syck_default_error_handler( SyckParser *, const char * );
 SYMID syck_yaml2byte_handler( SyckParser *, SyckNode * );
 char *syck_yaml2byte( char * );
 
@@ -445,7 +445,7 @@
 /*
  * Lexer prototypes
  */
-void syckerror( char * );
+void syckerror( const char * );
 int syckparse( void * );
 union YYSTYPE;
 int sycklex( union YYSTYPE *, SyckParser * );
Index: ext/syck/token.c
===================================================================
--- ext/syck/token.c	(revision 18169)
+++ ext/syck/token.c	(revision 18170)
@@ -2713,7 +2713,7 @@
 }
 
 void 
-syckerror( char *msg )
+syckerror( const char *msg )
 {
     if ( syck_parser_ptr->error_handler == NULL )
         syck_parser_ptr->error_handler = syck_default_error_handler;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]