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

ruby-changes:14073

From: nobu <ko1@a...>
Date: Mon, 23 Nov 2009 10:55:32 +0900 (JST)
Subject: [ruby-changes:14073] Ruby:r25886 (ruby_1_8, trunk): * dln.c (dln_find_1): removed duplication.

nobu	2009-11-23 10:52:21 +0900 (Mon, 23 Nov 2009)

  New Revision: 25886

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

  Log:
    * dln.c (dln_find_1): removed duplication.

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/dln.c
    trunk/ChangeLog
    trunk/dln.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25885)
+++ ChangeLog	(revision 25886)
@@ -1,3 +1,7 @@
+Mon Nov 23 10:52:19 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* dln.c (dln_find_1): removed duplication.
+
 Mon Nov 23 04:12:00 2009  Tanaka Akira  <akr@f...>
 
 	* enc/trans/newline.trans (fun_so_universal_newline): generate \n
Index: dln.c
===================================================================
--- dln.c	(revision 25885)
+++ dln.c	(revision 25886)
@@ -1560,6 +1560,10 @@
     const char *p = fname;
 #endif
 
+    static const char pathname_too_long[] = "openpath: pathname too long (ignored)\n\
+\tDirectory \"%.*s\"\n\tFile \"%s\"\n"
+#define PATHNAME_TOO_LONG() fprintf(stderr, pathname_too_long, (int)(bp - fbuf), fbuf, fname)
+
 #define RETURN_IF(expr) if (expr) return (char *)fname;
 
     RETURN_IF(!fname);
@@ -1681,10 +1685,7 @@
 	i = strlen(fname);
 	if (fspace < i) {
 	  toolong:
-	    fprintf(stderr, "openpath: pathname too long (ignored)\n");
-	    *bp = '\0';
-	    fprintf(stderr, "\tDirectory \"%s\"\n", fbuf);
-	    fprintf(stderr, "\tFile \"%s\"\n", fname);
+	    PATHNAME_TOO_LONG();
 	    goto next;
 	}
 	fspace -= i;
@@ -1695,9 +1696,7 @@
 	  needs_extension:
 	    for (j = 0; j < sizeof(extension) / sizeof(extension[0]); j++) {
 		if (fspace < strlen(extension[j])) {
-		    fprintf(stderr, "openpath: pathname too long (ignored)\n");
-		    fprintf(stderr, "\tDirectory \"%.*s\"\n", (int) (bp - fbuf), fbuf);
-		    fprintf(stderr, "\tFile \"%s%s\"\n", fname, extension[j]);
+		    PATHNAME_TOO_LONG();
 		    continue;
 		}
 		strlcpy(bp + i, extension[j], fspace);
Index: ruby_1_8/dln.c
===================================================================
--- ruby_1_8/dln.c	(revision 25885)
+++ ruby_1_8/dln.c	(revision 25886)
@@ -1711,6 +1711,10 @@
     const char *p = fname;
 #endif
 
+    static const char pathname_too_long[] = "openpath: pathname too long (ignored)\n\
+\tDirectory \"%.*s\"\n\tFile \"%s\"\n"
+#define PATHNAME_TOO_LONG() fprintf(stderr, pathname_too_long, (int)(bp - fbuf), fbuf, fname)
+
 #define RETURN_IF(expr) if (expr) return (char *)fname;
 
     RETURN_IF(!fname);
@@ -1832,10 +1836,7 @@
 	i = strlen(fname);
 	if (fspace < i) {
 	  toolong:
-	    fprintf(stderr, "openpath: pathname too long (ignored)\n");
-	    *bp = '\0';
-	    fprintf(stderr, "\tDirectory \"%s\"\n", fbuf);
-	    fprintf(stderr, "\tFile \"%s\"\n", fname);
+	    PATHNAME_TOO_LONG();
 	    goto next;
 	}
 	fspace -= i;
@@ -1846,9 +1847,7 @@
 	  needs_extension:
 	    for (j = 0; j < sizeof(extension) / sizeof(extension[0]); j++) {
 		if (fspace < strlen(extension[j])) {
-		    fprintf(stderr, "openpath: pathname too long (ignored)\n");
-		    fprintf(stderr, "\tDirectory \"%.*s\"\n", (int) (bp - fbuf), fbuf);
-		    fprintf(stderr, "\tFile \"%s%s\"\n", fname, extension[j]);
+		    PATHNAME_TOO_LONG();
 		    continue;
 		}
 		strcpy(bp + i, extension[j]);
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 25885)
+++ ruby_1_8/ChangeLog	(revision 25886)
@@ -1,5 +1,7 @@
-Mon Nov 23 10:39:13 2009  Nobuyoshi Nakada  <nobu@r...>
+Mon Nov 23 10:52:19 2009  Nobuyoshi Nakada  <nobu@r...>
 
+	* dln.c (dln_find_1): removed duplication.
+
 	* dln.c (dln_find_1): not use prototype definition.
 
 Thu Nov 19 23:22:40 2009  Shugo Maeda  <shugo@r...>

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

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