ext/glib2/rbglib_spawn.c in glib2-3.4.3 vs ext/glib2/rbglib_spawn.c in glib2-3.4.4
- old
+ new
@@ -1,8 +1,8 @@
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
+ * Copyright (C) 2011-2021 Ruby-GNOME Project Team
* Copyright (C) 2004 Masao Mutoh
* Copyright (C) 2004 Kazuhiro NISHIYAMA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -27,14 +27,15 @@
static ID id_call;
static ID id_new;
static void
-child_setup(gpointer func)
+child_setup(gpointer data)
{
- if (! NIL_P(func)){
- rb_funcall((VALUE)func, id_call, 0);
+ VALUE func = POINTER2RVAL(data);
+ if (!NIL_P(func)) {
+ rb_funcall(func, id_call, 0);
}
}
static VALUE
rg_s_async_with_pipes(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
@@ -202,23 +203,19 @@
RAISE_GERROR(err);
return ret;
}
-#ifdef HAVE_G_SPAWN_CLOSE_PID
-
#define RVAL2GPID(value) ((GPid)NUM2INT(pid))
static VALUE
rg_s_close_pid(G_GNUC_UNUSED VALUE self, VALUE pid)
{
g_spawn_close_pid(RVAL2GPID(pid));
return Qnil;
}
-#endif
-
void
Init_glib_spawn(void)
{
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Spawn");
@@ -229,12 +226,10 @@
RG_DEF_SMETHOD(async_with_pipes, 4);
RG_DEF_SMETHOD(async, 4);
RG_DEF_SMETHOD(sync, 4);
RG_DEF_SMETHOD(command_line_sync, 1);
RG_DEF_SMETHOD(command_line_async, 1);
-#ifdef HAVE_G_SPAWN_CLOSE_PID
RG_DEF_SMETHOD(close_pid, 1);
-#endif
rb_define_const(RG_TARGET_NAMESPACE, "LEAVE_DESCRIPTORS_OPEN", INT2NUM(G_SPAWN_LEAVE_DESCRIPTORS_OPEN));
rb_define_const(RG_TARGET_NAMESPACE, "DO_NOT_REAP_CHILD", INT2NUM(G_SPAWN_DO_NOT_REAP_CHILD));
rb_define_const(RG_TARGET_NAMESPACE, "SEARCH_PATH", INT2NUM(G_SPAWN_SEARCH_PATH));
rb_define_const(RG_TARGET_NAMESPACE, "STDOUT_TO_DEV_NULL", INT2NUM(G_SPAWN_STDOUT_TO_DEV_NULL));