On Apr 18, 2014 7:28 PM, "Cade Forester" <[email protected]> wrote: > > > + if (strcmp(setlocale(LC_NUMERIC, NULL), "C") != 0) > > strcmp() cause segmentation fault for NULL pointer > > -- > > diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c > --- a/src/gui_gtk_x11.c > +++ b/src/gui_gtk_x11.c > @@ -3144,7 +3144,8 @@ > # if defined(FEAT_FLOAT) && defined(LC_NUMERIC) > /* Make sure strtod() uses a decimal point, not a comma. Gnome init > * may change it. */ > - if (setlocale(LC_NUMERIC, NULL) != (char *) "C") > + char *s = setlocale(LC_NUMERIC, NULL); > + if (strcmp((s==NULL)?"":s, "C") != 0)
Why do you compare a known string with a known string here? You should use something like if(s == NULL || STRCMP(s, "C") != 0). Also note that vim uses STRCMP macro all over the place, not strcmp. > setlocale(LC_NUMERIC, "C"); > # endif > } > > -- > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups "vim_dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
