changeset 3433:1e217fa4ad7d

[xemacs-hg @ 2006-05-30 06:21:31 by stephent] Preferred fix for dangling declaration. <8764jo59cu.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Tue, 30 May 2006 06:21:31 +0000
parents 19303e5282eb
children 65f62c546342
files src/ChangeLog src/objects-x.c
diffstat 2 files changed, 35 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon May 29 21:51:14 2006 +0000
+++ b/src/ChangeLog	Tue May 30 06:21:31 2006 +0000
@@ -1,3 +1,8 @@
+2006-05-25  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* objects-x.c (x_find_charset_font): Keep local names local; wrap
+	the spurious declaration in a block, don't move it.
+
 2006-05-25  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* file-coding.c (output_bytes_in_ascii_and_hex):
--- a/src/objects-x.c	Mon May 29 21:51:14 2006 +0000
+++ b/src/objects-x.c	Tue May 30 06:21:31 2006 +0000
@@ -1215,7 +1215,6 @@
     stderr_out ("Failed fontconfig initialization\n");
   else
     {
-      struct charset_reporter *cr;
       FcPattern *fontxft;	/* long-lived, freed at end of this block */
       FcResult fcresult;
       FcConfig *fcc;
@@ -1303,34 +1302,40 @@
 	 Optimization:  cache the generated FcCharSet in the Mule charset.
          Don't forget to destroy it if the Mule charset gets deallocated. */
 
-      for (cr = charset_table;
-	   cr->charset && !EQ (*(cr->charset), charset);
-	   cr++)
-	;
+      {
+	/* This block possibly should be a function, but it generates
+	   multiple values.  I find the "pass an address to return the
+	   value in" idiom opaque, so prefer a block. */
+	struct charset_reporter *cr;
+	for (cr = charset_table;
+	     cr->charset && !EQ (*(cr->charset), charset);
+	     cr++)
+	  ;
 
-      if (cr->rfc3066)
-	{
-	  DECLARE_DEBUG_FONTNAME (name);
-	  CHECKING_LANG (0, eidata(name), cr->language);
-	  lang = cr->rfc3066;
-	}
-      else if (cr->charset)
-	{
-	  /* what the hey, build 'em on the fly */
-	  /* #### in the case of error this could return NULL! */
-	  fccs = mule_to_fc_charset (charset);
-	  lang = XSTRING_DATA (XSYMBOL (XCHARSET_NAME (charset))-> name);
-	}
-      else
-	{
-	  /* OK, we fell off the end of the table */
-	  warn_when_safe_lispobj (intern ("xft"), intern ("alert"),
-				  list2 (build_string ("unchecked charset"),
-					 charset));
+	if (cr->rfc3066)
+	  {
+	    DECLARE_DEBUG_FONTNAME (name);
+	    CHECKING_LANG (0, eidata(name), cr->language);
+	    lang = cr->rfc3066;
+	  }
+	else if (cr->charset)
+	  {
+	    /* what the hey, build 'em on the fly */
+	    /* #### in the case of error this could return NULL! */
+	    fccs = mule_to_fc_charset (charset);
+	    lang = XSTRING_DATA (XSYMBOL (XCHARSET_NAME (charset))-> name);
+	  }
+	else
+	  {
+	    /* OK, we fell off the end of the table */
+	    warn_when_safe_lispobj (intern ("xft"), intern ("alert"),
+				    list2 (build_string ("unchecked charset"),
+					   charset));
+	  }
 	  /* default to "en"
 	     #### THIS IS WRONG, WRONG, WRONG!!
 	     It is why we never fall through to XLFD-checking. */
-	}
+      }
 
       ASSERT_ASCTEXT_ASCII(lang);