Address review comments for the previous series
[deliverable/binutils-gdb.git] / gdb / remote-fileio.c
index c305171f6496605ead12f3b655c15a7410885cfa..0bd7b9663370002234a60f6a5e33bdd13564ea52 100644 (file)
@@ -1118,10 +1118,9 @@ static struct {
   { NULL, NULL }
 };
 
-static int
-do_remote_fileio_request (struct ui_out *uiout, void *buf_arg)
+static void
+do_remote_fileio_request (char *buf)
 {
-  char *buf = (char *) buf_arg;
   char *c;
   int idx;
 
@@ -1135,10 +1134,10 @@ do_remote_fileio_request (struct ui_out *uiout, void *buf_arg)
   for (idx = 0; remote_fio_func_map[idx].name; ++idx)
     if (!strcmp (remote_fio_func_map[idx].name, buf))
       break;
-  if (!remote_fio_func_map[idx].name)  /* ERROR: No such function.  */
-    return RETURN_ERROR;
-  remote_fio_func_map[idx].func (c);
-  return 0;
+  if (!remote_fio_func_map[idx].name)
+    remote_fileio_reply (-1, FILEIO_ENOSYS);
+  else
+    remote_fio_func_map[idx].func (c);
 }
 
 /* Close any open descriptors, and reinitialize the file mapping.  */
@@ -1170,8 +1169,6 @@ remote_fileio_reset (void)
 void
 remote_fileio_request (char *buf, int ctrlc_pending_p)
 {
-  int ex;
-
   /* Save the previous quit handler, so we can restore it.  No need
      for a cleanup since we catch all exceptions below.  Note that the
      quit handler is also restored by remote_fileio_reply just before
@@ -1188,20 +1185,18 @@ remote_fileio_request (char *buf, int ctrlc_pending_p)
     }
   else
     {
-      ex = catch_exceptions (current_uiout,
-                            do_remote_fileio_request, (void *)buf,
-                            RETURN_MASK_ALL);
-      switch (ex)
+      TRY
+       {
+         do_remote_fileio_request (buf);
+       }
+      CATCH (ex, RETURN_MASK_ALL)
        {
-       case RETURN_ERROR:
-         remote_fileio_reply (-1, FILEIO_ENOSYS);
-         break;
-       case RETURN_QUIT:
-         remote_fileio_reply (-1, FILEIO_EINTR);
-         break;
-       default:
-         break;
+         if (ex.reason == RETURN_QUIT)
+           remote_fileio_reply (-1, FILEIO_EINTR);
+         else
+           remote_fileio_reply (-1, FILEIO_EIO);
        }
+      END_CATCH
     }
 
   quit_handler = remote_fileio_o_quit_handler;
This page took 0.024226 seconds and 4 git commands to generate.