comparison src/fns.c @ 103095:65cc22e2c624

* fns.c (Flocale_info): Protect vector from GC during decoding. * process.c (Fstart_process): Protect argv strings from GC during encoding.
author Andreas Schwab <schwab@linux-m68k.org>
date Tue, 28 Apr 2009 19:02:26 +0000
parents dfed39918c22
children 2b13858c8a2f
comparison
equal deleted inserted replaced
103094:64ac89a8b9a8 103095:65cc22e2c624
3133 } 3133 }
3134 #ifdef DAY_1 3134 #ifdef DAY_1
3135 else if (EQ (item, Qdays)) /* e.g. for calendar-day-name-array */ 3135 else if (EQ (item, Qdays)) /* e.g. for calendar-day-name-array */
3136 { 3136 {
3137 Lisp_Object v = Fmake_vector (make_number (7), Qnil); 3137 Lisp_Object v = Fmake_vector (make_number (7), Qnil);
3138 int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7}; 3138 const int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7};
3139 int i; 3139 int i;
3140 struct gcpro gcpro1;
3141 GCPRO1 (v);
3140 synchronize_system_time_locale (); 3142 synchronize_system_time_locale ();
3141 for (i = 0; i < 7; i++) 3143 for (i = 0; i < 7; i++)
3142 { 3144 {
3143 str = nl_langinfo (days[i]); 3145 str = nl_langinfo (days[i]);
3144 val = make_unibyte_string (str, strlen (str)); 3146 val = make_unibyte_string (str, strlen (str));
3146 it is consistent with CODESET? If not, what to do? */ 3148 it is consistent with CODESET? If not, what to do? */
3147 Faset (v, make_number (i), 3149 Faset (v, make_number (i),
3148 code_convert_string_norecord (val, Vlocale_coding_system, 3150 code_convert_string_norecord (val, Vlocale_coding_system,
3149 0)); 3151 0));
3150 } 3152 }
3153 UNGCPRO;
3151 return v; 3154 return v;
3152 } 3155 }
3153 #endif /* DAY_1 */ 3156 #endif /* DAY_1 */
3154 #ifdef MON_1 3157 #ifdef MON_1
3155 else if (EQ (item, Qmonths)) /* e.g. for calendar-month-name-array */ 3158 else if (EQ (item, Qmonths)) /* e.g. for calendar-month-name-array */
3156 { 3159 {
3157 struct Lisp_Vector *p = allocate_vector (12); 3160 Lisp_Object v = Fmake_vector (make_number (12), Qnil);
3158 int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7, 3161 const int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7,
3159 MON_8, MON_9, MON_10, MON_11, MON_12}; 3162 MON_8, MON_9, MON_10, MON_11, MON_12};
3160 int i; 3163 int i;
3164 struct gcpro gcpro1;
3165 GCPRO1 (v);
3161 synchronize_system_time_locale (); 3166 synchronize_system_time_locale ();
3162 for (i = 0; i < 12; i++) 3167 for (i = 0; i < 12; i++)
3163 { 3168 {
3164 str = nl_langinfo (months[i]); 3169 str = nl_langinfo (months[i]);
3165 val = make_unibyte_string (str, strlen (str)); 3170 val = make_unibyte_string (str, strlen (str));
3166 p->contents[i] = 3171 Faset (v, make_number (i),
3167 code_convert_string_norecord (val, Vlocale_coding_system, 0); 3172 code_convert_string_norecord (val, Vlocale_coding_system, 0));
3168 } 3173 }
3169 XSETVECTOR (val, p); 3174 UNGCPRO;
3170 return val; 3175 return v;
3171 } 3176 }
3172 #endif /* MON_1 */ 3177 #endif /* MON_1 */
3173 /* LC_PAPER stuff isn't defined as accessible in glibc as of 2.3.1, 3178 /* LC_PAPER stuff isn't defined as accessible in glibc as of 2.3.1,
3174 but is in the locale files. This could be used by ps-print. */ 3179 but is in the locale files. This could be used by ps-print. */
3175 #ifdef PAPER_WIDTH 3180 #ifdef PAPER_WIDTH