diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2016-06-16 18:28:14 -0400 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2016-06-29 15:16:52 +0100 |
commit | 7ea4949cdac8f7a4636f92e9e9efceec90ff09e6 (patch) | |
tree | 47e0e071921389206fe6074639528c43397ae4c6 | |
parent | 8c6d08ab1b8ec57b81d77d44820f40625009b2cc (diff) | |
download | glib-7ea4949cdac8f7a4636f92e9e9efceec90ff09e6.tar.gz |
gmain: Add G_PID_FORMAT
This will be useful for printing out GPids in printf()-style functions.
https://bugzilla.gnome.org/show_bug.cgi?id=767765
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | docs/reference/glib/glib-sections.txt | 1 | ||||
-rw-r--r-- | glib/glibconfig.h.win32.in | 1 | ||||
-rw-r--r-- | glib/gmain.h | 11 |
4 files changed, 17 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 3d0daf27c..9552b9965 100644 --- a/configure.ac +++ b/configure.ac @@ -125,6 +125,7 @@ case "$host" in *-*-mingw*) glib_native_win32=yes glib_pid_type='void *' + glib_pid_format='p' glib_pollfd_format='%#x' glib_cv_stack_grows=no # Unfortunately the mingw implementations of C99-style snprintf and vsnprintf @@ -148,6 +149,7 @@ case "$host" in *) glib_native_win32=no glib_pid_type=int + glib_pid_format='i' glib_pollfd_format='%d' ;; esac @@ -2884,6 +2886,7 @@ _______EOF #define G_MODULE_SUFFIX "$g_module_suffix" typedef $g_pid_type GPid; +#define G_PID_FORMAT $g_pid_format #define GLIB_SYSDEF_AF_UNIX $g_af_unix #define GLIB_SYSDEF_AF_INET $g_af_inet @@ -3166,6 +3169,7 @@ g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations" g_module_suffix="$glib_gmodule_suffix" g_pid_type="$glib_pid_type" +g_pid_format="\"$glib_pid_format\"" g_pollfd_format="\"$glib_pollfd_format\"" case $host in diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index dae86a6c9..398ca95c9 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -571,6 +571,7 @@ g_idle_remove_by_data <SUBSECTION> GPid +G_PID_FORMAT GChildWatchFunc g_child_watch_source_new g_child_watch_add diff --git a/glib/glibconfig.h.win32.in b/glib/glibconfig.h.win32.in index 302d8dfae..ab7e68d04 100644 --- a/glib/glibconfig.h.win32.in +++ b/glib/glibconfig.h.win32.in @@ -242,6 +242,7 @@ typedef unsigned __int64 guintptr; * not a process identifier. */ typedef void * GPid; +#define G_PID_FORMAT "p" #define GLIB_SYSDEF_AF_UNIX 1 #define GLIB_SYSDEF_AF_INET 2 diff --git a/glib/gmain.h b/glib/gmain.h index 746edd756..1eaf9f72d 100644 --- a/glib/gmain.h +++ b/glib/gmain.h @@ -140,6 +140,17 @@ typedef struct _GSourceFuncs GSourceFuncs; * GPid is used in GLib only for descendant processes spawned with * the g_spawn functions. */ +/* defined in glibconfig.h */ + +/** + * G_PID_FORMAT: + * + * A format specifier that can be used in printf()-style format strings + * when printing a #GPid. + * + * Since: 2.50 + */ +/* defined in glibconfig.h */ /** * GSourceFunc: |