Add *.rej as a Diff filename pattern.

Add utils_strv_new() to duplicate a va_list of strings.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1263 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2007-02-08 16:26:45 +00:00
parent 091c88a952
commit d39c458655
5 changed files with 60 additions and 21 deletions

View File

@ -1,3 +1,11 @@
2007-02-08 Nick Treleaven <nick.treleaven@btinternet.com>
* src/utils.c, src/utils.h, src/filetypes.c,
data/filetype_extensions.conf:
Add *.rej as a Diff filename pattern.
Add utils_strv_new() to duplicate a va_list of strings.
2007-02-07 Frank Lanitz <frank@frank.uvena.de>
* data/pascal.tags, THANKS: Fixed a wrong autocompletion. Thanks to

View File

@ -28,6 +28,6 @@ SQL=*.sql;
LaTeX=*.tex;*.sty;*.idx;
O-Matrix=*.oms;
VHDL=*.vhd;*.vhdl;
Diff=*.diff;*.patch;
Diff=*.diff;*.patch;*.rej;
Conf=*.conf;*.ini;config;*rc;*.cfg;
None=*;

View File

@ -497,11 +497,8 @@ void filetypes_init_types()
filetypes[GEANY_FILETYPES_MAKE]->has_tags = TRUE;
filetypes[GEANY_FILETYPES_MAKE]->title = g_strdup(_("Makefile"));
filetypes[GEANY_FILETYPES_MAKE]->extension = g_strdup("mak");
{
gchar *patterns[] = {"*.mak", "*.mk", "GNUmakefile", "makefile", "Makefile",
"makefile.*", "Makefile.*", NULL};
filetypes[GEANY_FILETYPES_MAKE]->pattern = g_strdupv(patterns);
}
filetypes[GEANY_FILETYPES_MAKE]->pattern = utils_strv_new(
"*.mak", "*.mk", "GNUmakefile", "makefile", "Makefile", "makefile.*", "Makefile.*", NULL);
filetypes[GEANY_FILETYPES_MAKE]->style_func_ptr = styleset_makefile;
filetypes[GEANY_FILETYPES_MAKE]->comment_open = g_strdup("#");
filetypes[GEANY_FILETYPES_MAKE]->comment_close = NULL;
@ -518,10 +515,8 @@ void filetypes_init_types()
filetypes[GEANY_FILETYPES_XML]->has_tags = FALSE;
filetypes[GEANY_FILETYPES_XML]->title = g_strdup(_("XML source file"));
filetypes[GEANY_FILETYPES_XML]->extension = g_strdup("xml");
{
gchar *patterns[] = {"*.xml", "*.sgml", "*.xsl", "*.xslt", "*.xsd", NULL};
filetypes[GEANY_FILETYPES_XML]->pattern = g_strdupv(patterns);
}
filetypes[GEANY_FILETYPES_XML]->pattern = utils_strv_new(
"*.xml", "*.sgml", "*.xsl", "*.xslt", "*.xsd", NULL);
filetypes[GEANY_FILETYPES_XML]->style_func_ptr = styleset_xml;
filetypes[GEANY_FILETYPES_XML]->comment_open = g_strdup("<!--");
filetypes[GEANY_FILETYPES_XML]->comment_close = g_strdup("-->");
@ -557,11 +552,8 @@ void filetypes_init_types()
filetypes[GEANY_FILETYPES_HTML]->has_tags = FALSE;
filetypes[GEANY_FILETYPES_HTML]->title = g_strdup(_("HTML source file"));
filetypes[GEANY_FILETYPES_HTML]->extension = g_strdup("html");
{
gchar *patterns[] = {"*.htm", "*.html", "*.shtml", "*.hta", "*.htd", "*.htt",
"*.cfm", NULL};
filetypes[GEANY_FILETYPES_HTML]->pattern = g_strdupv(patterns);
}
filetypes[GEANY_FILETYPES_HTML]->pattern = utils_strv_new(
"*.htm", "*.html", "*.shtml", "*.hta", "*.htd", "*.htt", "*.cfm", NULL);
filetypes[GEANY_FILETYPES_HTML]->style_func_ptr = styleset_html;
filetypes[GEANY_FILETYPES_HTML]->comment_open = g_strdup("<!--");
filetypes[GEANY_FILETYPES_HTML]->comment_close = g_strdup("-->");
@ -676,10 +668,7 @@ void filetypes_init_types()
filetypes[GEANY_FILETYPES_DIFF]->has_tags = TRUE;
filetypes[GEANY_FILETYPES_DIFF]->title = g_strdup(_("Diff file"));
filetypes[GEANY_FILETYPES_DIFF]->extension = g_strdup("diff");
filetypes[GEANY_FILETYPES_DIFF]->pattern = g_new0(gchar*, 3);
filetypes[GEANY_FILETYPES_DIFF]->pattern[0] = g_strdup("*.diff");
filetypes[GEANY_FILETYPES_DIFF]->pattern[1] = g_strdup("*.patch");
filetypes[GEANY_FILETYPES_DIFF]->pattern[2] = NULL;
filetypes[GEANY_FILETYPES_DIFF]->pattern = utils_strv_new("*.diff", "*.patch", "*.rej", NULL);
filetypes[GEANY_FILETYPES_DIFF]->style_func_ptr = styleset_diff;
filetypes[GEANY_FILETYPES_DIFF]->comment_open = g_strdup("#");
filetypes[GEANY_FILETYPES_DIFF]->comment_close = NULL;

View File

@ -1469,6 +1469,42 @@ void utils_free_pointers(gpointer first, ...)
}
/* creates a string array deep copy of a series of non-NULL strings.
* the first argument is nothing special.
* the list must be ended with NULL.
* if first is NULL, NULL is returned. */
gchar **utils_strv_new(gchar *first, ...)
{
gsize strvlen, i;
va_list args;
gchar *str;
gchar **strv;
if (first == NULL)
return NULL;
strvlen = 1; // for first argument
// count other arguments
va_start(args, first);
for (; va_arg(args, gchar*) != NULL; strvlen++);
va_end(args);
strv = g_new(gchar*, strvlen + 1); // +1 for NULL terminator
strv[0] = g_strdup(first);
va_start(args, first);
for (i = 1; str = va_arg(args, gchar*), str != NULL; i++)
{
strv[i] = g_strdup(str);
}
va_end(args);
strv[i] = NULL;
return strv;
}
gint utils_mkdir(const gchar *path)
{
if (path == NULL || strlen(path) == 0)

View File

@ -154,6 +154,12 @@ gchar *utils_get_whitespace(gint amount);
* it will also be freed, the list should be ended with NULL */
void utils_free_pointers(gpointer first, ...);
/* creates a string array deep copy of a series of non-NULL strings.
* the first argument is nothing special.
* the list must be ended with NULL.
* if first is NULL, NULL is returned. */
gchar **utils_strv_new(gchar *first, ...);
gint utils_mkdir(const gchar *path);
#endif