gimp r24827 - in trunk: . app/base app/core app/pdb app/plug-in app/widgets tools/pdbgen tools/pdbgen/pdb
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24827 - in trunk: . app/base app/core app/pdb app/plug-in app/widgets tools/pdbgen tools/pdbgen/pdb
- Date: Thu, 7 Feb 2008 13:19:15 +0000 (GMT)
Author: mitch
Date: Thu Feb 7 13:19:15 2008
New Revision: 24827
URL: http://svn.gnome.org/viewvc/gimp?rev=24827&view=rev
Log:
2008-02-07 Michael Natterer <mitch gimp org>
* app/base/base-utils.[ch]: add get_pid() which returns getpid().
* app/base/base.c
* app/base/tile-swap.c
* app/core/gimp-utils.c
* app/plug-in/gimppluginshm.c
* app/widgets/gimpselectiondata.c
* tools/pdbgen/pdb/misc.pdb: use it instead of getpid() and remove
all the #ifdef'ed includes getpid() needs.
* tools/pdbgen/app.pl: remove support for these includes. Also
remove some perl cruft in the include handling which is not needed
any longer.
* app/pdb/misc_cmds.c: regenerated.
Modified:
trunk/ChangeLog
trunk/app/base/base-utils.c
trunk/app/base/base-utils.h
trunk/app/base/base.c
trunk/app/base/tile-swap.c
trunk/app/core/gimp-utils.c
trunk/app/pdb/misc_cmds.c
trunk/app/plug-in/gimppluginshm.c
trunk/app/widgets/gimpselectiondata.c
trunk/tools/pdbgen/app.pl
trunk/tools/pdbgen/pdb/misc.pdb
Modified: trunk/app/base/base-utils.c
==============================================================================
--- trunk/app/base/base-utils.c (original)
+++ trunk/app/base/base-utils.c Thu Feb 7 13:19:15 2008
@@ -27,14 +27,23 @@
#ifdef G_OS_WIN32
#define _WIN32_WINNT 0x0500
#include <windows.h>
+#include <process.h>
#endif
#include "base-utils.h"
+
#define NUM_PROCESSORS_DEFAULT 1
+
/* public functions */
+GPid
+get_pid (void)
+{
+ return getpid ();
+}
+
gint
get_number_of_processors (void)
{
Modified: trunk/app/base/base-utils.h
==============================================================================
--- trunk/app/base/base-utils.h (original)
+++ trunk/app/base/base-utils.h Thu Feb 7 13:19:15 2008
@@ -20,6 +20,7 @@
#define __BASE_H__
+GPid get_pid (void);
gint get_number_of_processors (void);
guint64 get_physical_memory_size (void);
Modified: trunk/app/base/base.c
==============================================================================
--- trunk/app/base/base.c (original)
+++ trunk/app/base/base.c Thu Feb 7 13:19:15 2008
@@ -21,18 +21,12 @@
#include <signal.h>
#include <stdlib.h>
#include <string.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
#include <sys/types.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#ifdef G_OS_WIN32
-#include <process.h> /* for _getpid() */
#include "libgimpbase/gimpwin32-io.h"
#endif
Modified: trunk/app/base/tile-swap.c
==============================================================================
--- trunk/app/base/tile-swap.c (original)
+++ trunk/app/base/tile-swap.c Thu Feb 7 13:19:15 2008
@@ -35,8 +35,6 @@
#ifdef G_OS_WIN32
#include <windows.h>
#include "libgimpbase/gimpwin32-io.h"
-#include <process.h>
-#define getpid _getpid
#endif
#include "base-types.h"
@@ -48,6 +46,7 @@
#define _O_TEMPORARY 0
#endif
+#include "base-utils.h"
#include "tile.h"
#include "tile-rowhints.h"
#include "tile-swap.h"
@@ -169,7 +168,7 @@
g_return_if_fail (path != NULL);
dirname = gimp_config_path_expand (path, TRUE, NULL);
- basename = g_strdup_printf ("gimpswap.%lu", (unsigned long) getpid ());
+ basename = g_strdup_printf ("gimpswap.%lu", (unsigned long) get_pid ());
/* create the swap directory if it doesn't exist */
if (! g_file_test (dirname, G_FILE_TEST_EXISTS))
Modified: trunk/app/core/gimp-utils.c
==============================================================================
--- trunk/app/core/gimp-utils.c (original)
+++ trunk/app/core/gimp-utils.c Thu Feb 7 13:19:15 2008
@@ -26,18 +26,6 @@
#include <langinfo.h>
#endif
-#include <sys/types.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <glib.h>
-
-#ifdef G_OS_WIN32
-#include <process.h>
-#endif
-
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
@@ -48,6 +36,8 @@
#include "core-types.h"
+#include "base/base-utils.h"
+
#include "config/gimpbaseconfig.h"
#include "gimp.h"
@@ -491,7 +481,7 @@
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (id == 0)
- pid = getpid ();
+ pid = get_pid ();
if (extension)
basename = g_strdup_printf ("gimp-temp-%d%d.%s", pid, id++, extension);
Modified: trunk/app/pdb/misc_cmds.c
==============================================================================
--- trunk/app/pdb/misc_cmds.c (original)
+++ trunk/app/pdb/misc_cmds.c Thu Feb 7 13:19:15 2008
@@ -20,18 +20,6 @@
#include "config.h"
-#include <glib.h>
-
-#ifdef G_OS_WIN32
-#include <process.h>
-#endif
-
-#include <sys/types.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
#include <glib-object.h>
@@ -42,6 +30,7 @@
#include "gimpprocedure.h"
#include "core/gimpparamspecs.h"
+#include "base/base-utils.h"
#include "core/gimp.h"
#include "internal_procs.h"
@@ -77,7 +66,7 @@
GValueArray *return_vals;
gint32 pid = 0;
- pid = getpid ();
+ pid = get_pid ();
return_vals = gimp_procedure_get_return_values (procedure, TRUE);
g_value_set_int (&return_vals->values[1], pid);
Modified: trunk/app/plug-in/gimppluginshm.c
==============================================================================
--- trunk/app/plug-in/gimppluginshm.c (original)
+++ trunk/app/plug-in/gimppluginshm.c Thu Feb 7 13:19:15 2008
@@ -64,6 +64,7 @@
#include "plug-in-types.h"
+#include "base/base-utils.h"
#include "base/tile.h"
#include "gimppluginshm.h"
@@ -180,7 +181,7 @@
gint shm_fd;
/* Our shared memory id will be our process ID */
- pid = getpid ();
+ pid = get_pid ();
/* From the id, derive the file map name */
g_snprintf (shm_handle, sizeof (shm_handle), "/gimp-shm-%d", pid);
Modified: trunk/app/widgets/gimpselectiondata.c
==============================================================================
--- trunk/app/widgets/gimpselectiondata.c (original)
+++ trunk/app/widgets/gimpselectiondata.c Thu Feb 7 13:19:15 2008
@@ -18,24 +18,16 @@
#include "config.h"
-#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
#include <gtk/gtk.h>
-#ifdef G_OS_WIN32
-#include <process.h> /* getpid() : defined from _getpid by GLib */
-#endif
-
#include "libgimpcolor/gimpcolor.h"
#include "widgets-types.h"
+#include "base/base-utils.h"
+
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpcontainer.h"
@@ -365,7 +357,7 @@
g_return_if_fail (selection != NULL);
g_return_if_fail (GIMP_IS_IMAGE (image));
- str = g_strdup_printf ("%d:%d", getpid (), gimp_image_get_ID (image));
+ str = g_strdup_printf ("%d:%d", get_pid (), gimp_image_get_ID (image));
gtk_selection_data_set (selection, selection->target,
8, (guchar *) str, strlen (str) + 1);
@@ -390,7 +382,7 @@
return NULL;
if (sscanf (str, "%i:%i", &pid, &ID) == 2 &&
- pid == getpid ())
+ pid == get_pid ())
{
image = gimp_image_get_by_ID (gimp, ID);
}
@@ -410,7 +402,7 @@
g_return_if_fail (selection != NULL);
g_return_if_fail (GIMP_IS_IMAGE (image));
- str = g_strdup_printf ("%d:%d:%d", getpid (), gimp_image_get_ID (image),
+ str = g_strdup_printf ("%d:%d:%d", get_pid (), gimp_image_get_ID (image),
(gint) channel);
gtk_selection_data_set (selection, selection->target,
@@ -441,7 +433,7 @@
return NULL;
if (sscanf (str, "%i:%i:%i", &pid, &ID, &ch) == 3 &&
- pid == getpid ())
+ pid == get_pid ())
{
image = gimp_image_get_by_ID (gimp, ID);
@@ -463,7 +455,7 @@
g_return_if_fail (selection != NULL);
g_return_if_fail (GIMP_IS_ITEM (item));
- str = g_strdup_printf ("%d:%d", getpid (), gimp_item_get_ID (item));
+ str = g_strdup_printf ("%d:%d", get_pid (), gimp_item_get_ID (item));
gtk_selection_data_set (selection, selection->target,
8, (guchar *) str, strlen (str) + 1);
@@ -488,7 +480,7 @@
return NULL;
if (sscanf (str, "%i:%i", &pid, &ID) == 2 &&
- pid == getpid ())
+ pid == get_pid ())
{
item = gimp_item_get_by_ID (gimp, ID);
}
@@ -513,7 +505,7 @@
{
gchar *str;
- str = g_strdup_printf ("%d:%p:%s", getpid (), object, name);
+ str = g_strdup_printf ("%d:%p:%s", get_pid (), object, name);
gtk_selection_data_set (selection, selection->target,
8, (guchar *) str, strlen (str) + 1);
g_free (str);
@@ -680,7 +672,7 @@
return NULL;
if (sscanf (str, "%i:%p:%n", &pid, &object_addr, &name_offset) >= 2 &&
- pid == getpid () && name_offset > 0)
+ pid == get_pid () && name_offset > 0)
{
gchar *name = str + name_offset;
Modified: trunk/tools/pdbgen/app.pl
==============================================================================
--- trunk/tools/pdbgen/app.pl (original)
+++ trunk/tools/pdbgen/app.pl Thu Feb 7 13:19:15 2008
@@ -681,23 +681,9 @@
}
$x cmp $y;
} keys %{$out->{headers}};
- my $headers = ""; my $lib = 0; my $seen = 0; my $nl = 0;
- my $sys = 0; my $base = 0;
+ my $headers = "";
+ my $lib = 0; my $seen = 0; my $sys = 0; my $base = 0;
foreach (@headers) {
- $headers .= "\n" if $nl;
- $nl = 0;
-
- if ($_ eq '<unistd.h>') {
- $headers .= "\n" if $seen;
- $headers .= "#ifdef HAVE_UNISTD_H\n";
- }
- if ($_ eq '<process.h>') {
- $headers .= "\n" if $seen;
- $headers .= "#include <glib.h>\n\n";
- $headers .= "#ifdef G_OS_WIN32\n";
- }
-
-
$seen++ if /^</;
if ($sys == 0 && !/^</) {
@@ -731,20 +717,6 @@
}
$headers .= "#include $_\n";
-
- if ($_ eq '<unistd.h>') {
- $headers .= "#endif\n";
- $seen = 0;
- $nl = 1;
- }
-
- if ($_ eq '<process.h>') {
- $headers .= "#endif\n";
- $seen = 0;
- $nl = 1;
- }
-
- $headers .= "\n" if $_ eq '"config.h"';
}
$headers .= "\n#include \"internal_procs.h\"\n";
Modified: trunk/tools/pdbgen/pdb/misc.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/misc.pdb (original)
+++ trunk/tools/pdbgen/pdb/misc.pdb Thu Feb 7 13:19:15 2008
@@ -56,10 +56,10 @@
);
%invoke = (
- headers => [ qw(<sys/types.h> <unistd.h> <process.h>) ],
+ headers => [ qw("base/base-utils.h") ],
code => <<'CODE'
{
- pid = getpid ();
+ pid = get_pid ();
}
CODE
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]