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

ruby-changes:17800

From: naruse <ko1@a...>
Date: Wed, 17 Nov 2010 15:24:33 +0900 (JST)
Subject: [ruby-changes:17800] Ruby:r29811 (trunk): * regint.h (OnigOpInfoType): constify name.

naruse	2010-11-17 15:21:11 +0900 (Wed, 17 Nov 2010)

  New Revision: 29811

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

  Log:
    * regint.h (OnigOpInfoType): constify name.
    
    * regcomp.c (op2name): constify return value.
    
    * regcomp.c (onig_print_compiled_byte_code): use PRIuPTR and
      uintptr_t to clean warnings.
    
    * regcomp.c (print_indent_tree): use PRIxPTR and intptr_t.
    
    * regexec.c (match_at): use PRIdPTR and intptr_t.

  Modified files:
    trunk/ChangeLog
    trunk/regcomp.c
    trunk/regexec.c
    trunk/regint.h

Index: regcomp.c
===================================================================
--- regcomp.c	(revision 29810)
+++ regcomp.c	(revision 29811)
@@ -5808,7 +5808,7 @@
   { -1, "", ARG_NON }
 };
 
-static char*
+static const char*
 op2name(int opcode)
 {
   int i;
@@ -6009,7 +6009,7 @@
 
         GET_POINTER_INC(cc, bp);
         n = bitset_on_num(cc->bs);
-        fprintf(f, ":%u:%d", (unsigned int )cc, n);
+        fprintf(f, ":%"PRIuPTR":%d", (uintptr_t)cc, n);
       }
       break;
 
@@ -6141,9 +6141,9 @@
   case NT_LIST:
   case NT_ALT:
     if (NTYPE(node) == NT_LIST)
-      fprintf(f, "<list:%x>\n", (int )node);
+      fprintf(f, "<list:%"PRIxPTR">\n", (intptr_t)node);
     else
-      fprintf(f, "<alt:%x>\n", (int )node);
+      fprintf(f, "<alt:%"PRIxPTR">\n", (intptr_t)node);
 
     print_indent_tree(f, NCAR(node), indent + add);
     while (IS_NOT_NULL(node = NCDR(node))) {
@@ -6156,8 +6156,8 @@
     break;
 
   case NT_STR:
-    fprintf(f, "<string%s:%x>",
-	    (NSTRING_IS_RAW(node) ? "-raw" : ""), (int )node);
+    fprintf(f, "<string%s:%"PRIxPTR">",
+	    (NSTRING_IS_RAW(node) ? "-raw" : ""), (intptr_t)node);
     for (p = NSTR(node)->s; p < NSTR(node)->end; p++) {
       if (*p >= 0x20 && *p < 0x7f)
 	fputc(*p, f);
@@ -6168,11 +6168,11 @@
     break;
 
   case NT_CCLASS:
-    fprintf(f, "<cclass:%x>", (int )node);
+    fprintf(f, "<cclass:%"PRIxPTR">", (intptr_t)node);
     if (IS_NCCLASS_NOT(NCCLASS(node))) fputs(" not", f);
     if (NCCLASS(node)->mbuf) {
       BBuf* bbuf = NCCLASS(node)->mbuf;
-      for (i = 0; i < bbuf->used; i++) {
+      for (i = 0; i < (int)bbuf->used; i++) {
 	if (i > 0) fprintf(f, ",");
 	fprintf(f, "%0x", bbuf->p[i]);
       }
@@ -6180,7 +6180,7 @@
     break;
 
   case NT_CTYPE:
-    fprintf(f, "<ctype:%x> ", (int )node);
+    fprintf(f, "<ctype:%"PRIxPTR"> ", (intptr_t)node);
     switch (NCTYPE(node)->ctype) {
     case ONIGENC_CTYPE_WORD:
       if (NCTYPE(node)->not != 0)
@@ -6196,11 +6196,11 @@
     break;
 
   case NT_CANY:
-    fprintf(f, "<anychar:%x>", (int )node);
+    fprintf(f, "<anychar:%"PRIxPTR">", (intptr_t)node);
     break;
 
   case NT_ANCHOR:
-    fprintf(f, "<anchor:%x> ", (int )node);
+    fprintf(f, "<anchor:%"PRIxPTR"> ", (intptr_t)node);
     switch (NANCHOR(node)->type) {
     case ANCHOR_BEGIN_BUF:      fputs("begin buf",      f); break;
     case ANCHOR_END_BUF:        fputs("end buf",        f); break;
@@ -6231,7 +6231,7 @@
       int* p;
       BRefNode* br = NBREF(node);
       p = BACKREFS_P(br);
-      fprintf(f, "<backref:%x>", (int )node);
+      fprintf(f, "<backref:%"PRIxPTR">", (intptr_t)node);
       for (i = 0; i < br->back_num; i++) {
 	if (i > 0) fputs(", ", f);
 	fprintf(f, "%d", p[i]);
@@ -6243,21 +6243,21 @@
   case NT_CALL:
     {
       CallNode* cn = NCALL(node);
-      fprintf(f, "<call:%x>", (int )node);
+      fprintf(f, "<call:%"PRIxPTR">", (intptr_t)node);
       p_string(f, cn->name_end - cn->name, cn->name);
     }
     break;
 #endif
 
   case NT_QTFR:
-    fprintf(f, "<quantifier:%x>{%d,%d}%s\n", (int )node,
+    fprintf(f, "<quantifier:%"PRIxPTR">{%d,%d}%s\n", (intptr_t)node,
 	    NQTFR(node)->lower, NQTFR(node)->upper,
 	    (NQTFR(node)->greedy ? "" : "?"));
     print_indent_tree(f, NQTFR(node)->target, indent + add);
     break;
 
   case NT_ENCLOSE:
-    fprintf(f, "<enclose:%x> ", (int )node);
+    fprintf(f, "<enclose:%"PRIxPTR"> ", (intptr_t)node);
     switch (NENCLOSE(node)->type) {
     case ENCLOSE_OPTION:
       fprintf(f, "option:%d\n", NENCLOSE(node)->option);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29810)
+++ ChangeLog	(revision 29811)
@@ -1,3 +1,16 @@
+Wed Nov 17 15:16:48 2010  NARUSE, Yui  <naruse@r...>
+
+	* regint.h (OnigOpInfoType): constify name.
+
+	* regcomp.c (op2name): constify return value.
+
+	* regcomp.c (onig_print_compiled_byte_code): use PRIuPTR and
+	  uintptr_t to clean warnings.
+
+	* regcomp.c (print_indent_tree): use PRIxPTR and intptr_t.
+
+	* regexec.c (match_at): use PRIdPTR and intptr_t.
+
 Wed Nov 17 09:49:10 2010  NARUSE, Yui  <naruse@r...>
 
 	* enc/shift_jis.c (property_name_to_ctype): fix memory leak.
Index: regint.h
===================================================================
--- regint.h	(revision 29810)
+++ regint.h	(revision 29811)
@@ -786,7 +786,7 @@
 
 typedef struct {
   short int opcode;
-  char*     name;
+  const char* name;
   short int arg_type;
 } OnigOpInfoType;
 
Index: regexec.c
===================================================================
--- regexec.c	(revision 29810)
+++ regexec.c	(revision 29811)
@@ -1289,8 +1289,8 @@
   }
 
 #ifdef ONIG_DEBUG_MATCH
-  fprintf(stderr, "match_at: str: %d, end: %d, start: %d, sprev: %d\n",
-	  (int )str, (int )end, (int )sstart, (int )sprev);
+  fprintf(stderr, "match_at: str: %"PRIdPTR", end: %"PRIdPTR", start: %"PRIdPTR", sprev: %"PRIdPTR"\n",
+	  (intptr_t)str, (intptr_t)end, (intptr_t)sstart, (intptr_t)sprev);
   fprintf(stderr, "size: %d, start offset: %d\n",
 	  (int )(end - str), (int )(sstart - str));
 #endif
@@ -2345,8 +2345,8 @@
 	STACK_NULL_CHECK(isnull, mem, s);
 	if (isnull) {
 #ifdef ONIG_DEBUG_MATCH
-	  fprintf(stderr, "NULL_CHECK_END: skip  id:%d, s:%d\n",
-		  (int )mem, (int )s);
+	  fprintf(stderr, "NULL_CHECK_END: skip  id:%d, s:%"PRIdPTR"\n",
+		  (int )mem, (intptr_t )s);
 #endif
 	null_check_found:
 	  /* empty loop founded, skip next instruction */
@@ -2380,8 +2380,8 @@
 	STACK_NULL_CHECK_MEMST(isnull, mem, s, reg);
 	if (isnull) {
 #ifdef ONIG_DEBUG_MATCH
-	  fprintf(stderr, "NULL_CHECK_END_MEMST: skip  id:%d, s:%d\n",
-		  (int )mem, (int )s);
+	  fprintf(stderr, "NULL_CHECK_END_MEMST: skip  id:%d, s:%"PRIdPTR"\n",
+		  (int )mem, (intptr_t )s);
 #endif
 	  if (isnull == -1) goto fail;
 	  goto 	null_check_found;
@@ -2406,8 +2406,8 @@
 #endif
 	if (isnull) {
 #ifdef ONIG_DEBUG_MATCH
-	  fprintf(stderr, "NULL_CHECK_END_MEMST_PUSH: skip  id:%d, s:%d\n",
-		  (int )mem, (int )s);
+	  fprintf(stderr, "NULL_CHECK_END_MEMST_PUSH: skip  id:%d, s:%"PRIdPTR"\n",
+		  (int )mem, (intptr_t )s);
 #endif
 	  if (isnull == -1) goto fail;
 	  goto 	null_check_found;

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

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