Commit 5cebb047 authored by David Odin's avatar David Odin
Browse files

use the G_N_ELEMENTS macro where appropriate,

removing a bunch of unuseful static variables.
Changed some g_malloc to g_new while I was on it.
parent aa201cad
......@@ -109,7 +109,7 @@ siod_init (gint local_register_scripts)
register_scripts = local_register_scripts;
/* init the interpreter */
process_cla (sizeof (siod_argv) / sizeof (char *), siod_argv, 1);
process_cla (G_N_ELEMENTS (siod_argv), siod_argv, 1);
init_storage ();
init_subrs ();
init_trace ();
......
......@@ -86,20 +86,17 @@ script_fu_query (void)
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, [non-interactive]" }
};
static gint nconsole_args = sizeof (console_args) / sizeof (console_args[0]);
static GimpParamDef textconsole_args[] =
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, [non-interactive]" }
};
static gint ntextconsole_args = sizeof (textconsole_args) / sizeof (textconsole_args[0]);
static GimpParamDef eval_args[] =
{
{ GIMP_PDB_INT32, "run_mode", "[Interactive], non-interactive" },
{ GIMP_PDB_STRING, "code", "The code to evaluate" }
};
static gint neval_args = sizeof (eval_args) / sizeof (eval_args[0]);
static GimpParamDef server_args[] =
{
......@@ -107,7 +104,6 @@ script_fu_query (void)
{ GIMP_PDB_INT32, "port", "The port on which to listen for requests" },
{ GIMP_PDB_STRING, "logfile", "The file to log server activity to" }
};
static gint nserver_args = sizeof (server_args) / sizeof (server_args[0]);
gimp_plugin_domain_register ("gimp-script-fu", NULL);
......@@ -131,7 +127,7 @@ script_fu_query (void)
N_("<Toolbox>/Xtns/Script-Fu/Console..."),
NULL,
GIMP_EXTENSION,
nconsole_args, 0,
G_N_ELEMENTS (console_args), 0,
console_args, NULL);
gimp_install_procedure ("extension_script_fu_text_console",
......@@ -143,7 +139,7 @@ script_fu_query (void)
NULL,
NULL,
GIMP_EXTENSION,
ntextconsole_args, 0,
G_N_ELEMENTS (textconsole_args), 0,
textconsole_args, NULL);
#ifndef G_OS_WIN32
......@@ -156,7 +152,7 @@ script_fu_query (void)
N_("<Toolbox>/Xtns/Script-Fu/Server..."),
NULL,
GIMP_EXTENSION,
nserver_args, 0,
G_N_ELEMENTS (server_args), 0,
server_args, NULL);
#endif
......@@ -169,7 +165,7 @@ script_fu_query (void)
NULL,
NULL,
GIMP_EXTENSION,
neval_args, 0,
G_N_ELEMENTS (eval_args), 0,
eval_args, NULL);
}
......@@ -275,7 +271,6 @@ script_fu_auxillary_init (void)
{
{ GIMP_PDB_INT32, "run_mode", "[Interactive], non-interactive" }
};
static gint nargs = sizeof (args) / sizeof (args[0]);
gimp_install_temp_proc ("script_fu_refresh",
_("Re-read all available scripts"),
......@@ -286,7 +281,7 @@ script_fu_auxillary_init (void)
N_("<Toolbox>/Xtns/Script-Fu/Refresh"),
NULL,
GIMP_TEMPORARY,
nargs, 0,
G_N_ELEMENTS (args), 0,
args, NULL,
script_fu_refresh_proc);
}
......
......@@ -109,7 +109,7 @@ siod_init (gint local_register_scripts)
register_scripts = local_register_scripts;
/* init the interpreter */
process_cla (sizeof (siod_argv) / sizeof (char *), siod_argv, 1);
process_cla (G_N_ELEMENTS (siod_argv), siod_argv, 1);
init_storage ();
init_subrs ();
init_trace ();
......
......@@ -120,7 +120,6 @@ query_2 (void)
{ GIMP_PDB_INT8, "tangent_surround", "tangent_surround"},
};
static GimpParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
gimp_install_procedure ("plug_in_sel2path_advanced",
......@@ -132,7 +131,7 @@ query_2 (void)
NULL,
"RGB*, INDEXED*, GRAY*",
GIMP_PLUGIN,
nargs, nreturn_vals,
G_N_ELEMENTS (args), nreturn_vals,
args, return_vals);
}
......@@ -146,7 +145,6 @@ query (void)
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
};
static GimpParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
INIT_I18N();
......@@ -160,7 +158,7 @@ query (void)
N_("<Image>/Select/To Path"),
"RGB*, INDEXED*, GRAY*",
GIMP_PLUGIN,
nargs, nreturn_vals,
G_N_ELEMENTS (args), nreturn_vals,
args, return_vals);
query_2 ();
......
......@@ -104,9 +104,6 @@ query (void)
{
{ GIMP_PDB_IMAGE, "image", "Output image" },
};
static gint nload_args = sizeof (load_args) / sizeof (load_args[0]);
static gint nload_return_vals = (sizeof (load_return_vals) /
sizeof (load_return_vals[0]));
static GimpParamDef save_args[] =
{
......@@ -117,7 +114,6 @@ query (void)
{ GIMP_PDB_STRING, "raw_filename", "The name of the file to save the image in" },
{ GIMP_PDB_INT32, "compression", "Compression level (0 = none, 1 = RLE, 2 = ARLE)" }
};
static gint nsave_args = sizeof (save_args) / sizeof (save_args[0]);
INIT_I18N();
......@@ -130,8 +126,8 @@ query (void)
"<Load>/SGI",
NULL,
GIMP_PLUGIN,
nload_args,
nload_return_vals,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args,
load_return_vals);
......@@ -144,7 +140,7 @@ query (void)
"<Save>/SGI",
"RGB*,GRAY*",
GIMP_PLUGIN,
nsave_args,
G_N_ELEMENTS (save_args),
0,
save_args,
NULL);
......
......@@ -130,7 +130,6 @@ query (void)
{ GIMP_PDB_STRING, "url", "URL of a document to open" },
{ GIMP_PDB_INT32, "new_window", "Create a new window or use existing one?" },
};
static gint nargs = sizeof (args) / sizeof (args[0]);
gimp_install_procedure ("extension_web_browser",
"open URL in Netscape",
......@@ -141,7 +140,7 @@ query (void)
N_("<Toolbox>/Xtns/Web Browser/Open URL..."),
NULL,
GIMP_EXTENSION,
nargs, 0,
G_N_ELEMENTS (args), 0,
args, NULL);
}
......
......@@ -447,9 +447,6 @@ query (void)
{
{ GIMP_PDB_IMAGE, "image", "Output image" },
};
static gint nload_args = sizeof (load_args) / sizeof (load_args[0]);
static gint nload_return_vals = (sizeof (load_return_vals) /
sizeof (load_return_vals[0]));
static GimpParamDef save_args[] =
{
......@@ -463,7 +460,6 @@ query (void)
{ GIMP_PDB_INT32, "optimize", "Optimization of entropy encoding parameters" },
{ GIMP_PDB_INT32, "clr_transparent", "set all full-transparent pixels to 0" },
};
static gint nsave_args = sizeof (save_args) / sizeof (save_args[0]);
INIT_I18N ();
......@@ -476,7 +472,8 @@ query (void)
"<Load>/xjt",
NULL,
GIMP_PLUGIN,
nload_args, nload_return_vals,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_install_procedure ("file_xjt_save",
......@@ -488,7 +485,7 @@ query (void)
"<Save>/xjt",
"RGB*, GRAY*",
GIMP_PLUGIN,
nsave_args, 0,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_xjt_load",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment