diff options
Diffstat (limited to 'src/gfilenotify.c')
-rw-r--r-- | src/gfilenotify.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gfilenotify.c b/src/gfilenotify.c index 1e0f4160816..14fcf7f4776 100644 --- a/src/gfilenotify.c +++ b/src/gfilenotify.c @@ -77,7 +77,6 @@ dir_monitor_callback (GFileMonitor *monitor, /* Determine callback function. */ monitor_object = make_pointer_integer (monitor); - eassert (INTEGERP (monitor_object)); watch_object = assq_no_quit (monitor_object, watch_list); if (CONSP (watch_object)) @@ -203,10 +202,10 @@ will be reported only in case of the `moved' event. */) if (! monitor) xsignal2 (Qfile_notify_error, build_string ("Cannot watch file"), file); - Lisp_Object watch_descriptor = make_pointer_integer (monitor); + Lisp_Object watch_descriptor = make_pointer_integer_unsafe (monitor); - /* Check the dicey assumption that make_pointer_integer is safe. */ - if (! INTEGERP (watch_descriptor)) + if (! (FIXNUMP (watch_descriptor) + && XFIXNUMPTR (watch_descriptor) == monitor)) { g_object_unref (monitor); xsignal2 (Qfile_notify_error, build_string ("Unsupported file watcher"), @@ -239,8 +238,8 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) xsignal2 (Qfile_notify_error, build_string ("Not a watch descriptor"), watch_descriptor); - eassert (INTEGERP (watch_descriptor)); - GFileMonitor *monitor = XINTPTR (watch_descriptor); + eassert (FIXNUMP (watch_descriptor)); + GFileMonitor *monitor = XFIXNUMPTR (watch_descriptor); if (!g_file_monitor_is_cancelled (monitor) && !g_file_monitor_cancel (monitor)) xsignal2 (Qfile_notify_error, build_string ("Could not rm watch"), @@ -271,7 +270,7 @@ invalid. */) return Qnil; else { - GFileMonitor *monitor = XINTPTR (watch_descriptor); + GFileMonitor *monitor = XFIXNUMPTR (watch_descriptor); return g_file_monitor_is_cancelled (monitor) ? Qnil : Qt; } } @@ -290,7 +289,7 @@ If WATCH-DESCRIPTOR is not valid, nil is returned. */) return Qnil; else { - GFileMonitor *monitor = XINTPTR (watch_descriptor); + GFileMonitor *monitor = XFIXNUMPTR (watch_descriptor); return intern (G_OBJECT_TYPE_NAME (monitor)); } } |