User: stephent
  Date: 06/05/30 08:21:35
  Modified:    xemacs/src objects-x.c ChangeLog
Log:
Preferred fix for dangling declaration. <8764jo59cu.fsf(a)tleepslib.sk.tsukuba.ac.jp>
Revision  Changes    Path
1.42      +31 -26    XEmacs/xemacs/src/objects-x.c
Index: objects-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/objects-x.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -p -r1.41 -r1.42
--- objects-x.c	2006/05/24 16:30:32	1.41
+++ objects-x.c	2006/05/30 06:21:31	1.42
@@ -1215,7 +1215,6 @@ x_find_charset_font (Lisp_Object device,
     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 @@ x_find_charset_font (Lisp_Object device,
 	 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++)
-	;
-
-      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));
+      {
+	/* 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));
+	  }
 	  /* default to "en"
 	     #### THIS IS WRONG, WRONG, WRONG!!
 	     It is why we never fall through to XLFD-checking. */
-	}
+      }
 
       ASSERT_ASCTEXT_ASCII(lang);
 
1.970     +5 -0      XEmacs/xemacs/src/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.969
retrieving revision 1.970
diff -u -p -r1.969 -r1.970
--- ChangeLog	2006/05/25 08:04:56	1.969
+++ ChangeLog	2006/05/30 06:21:31	1.970
@@ -1,3 +1,8 @@
+2006-05-25  Stephen J. Turnbull  <stephen(a)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(a)parhasard.net>
 
 	* file-coding.c (output_bytes_in_ascii_and_hex):
    
    
    
 
                    
                    
                        
                        Show replies by date