[tor-commits] [tor/master] Replaced ST_* enum prefix for stream status with IO_STREAM_*.

nickm at torproject.org nickm at torproject.org
Fri Oct 7 20:03:17 UTC 2011


commit 14c5a24fe74f7ebaf94c69721025f142d42ef1e0
Author: George Kadianakis <desnacked at gmail.com>
Date:   Mon Jul 18 02:35:29 2011 +0200

    Replaced ST_* enum prefix for stream status with IO_STREAM_*.
---
 src/common/util.c   |   18 +++++++++---------
 src/common/util.h   |    8 ++++----
 src/or/transports.c |    6 +++---
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/common/util.c b/src/common/util.c
index 5f4472b..c2db542 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3140,10 +3140,10 @@ tor_spawn_background(const char *const filename, int *stdout_read,
  * fits your needs before using it.
  *
  * Returns:
- * ST_CLOSED: If the stream is closed.
- * ST_EAGAIN: If there is nothing to read and we should check back later.
- * ST_TERM: If something is wrong with the stream.
- * ST_OKAY: If everything went okay and we got a string in <b>buf_out</b>. */
+ * IO_STREAM_CLOSED: If the stream is closed.
+ * IO_STREAM_EAGAIN: If there is nothing to read and we should check back later.
+ * IO_STREAM_TERM: If something is wrong with the stream.
+ * IO_STREAM_OKAY: If everything went okay and we got a string in <b>buf_out</b>. */
 enum stream_status
 get_string_from_pipe(FILE *stream, char *buf_out, size_t count)
 {
@@ -3156,14 +3156,14 @@ get_string_from_pipe(FILE *stream, char *buf_out, size_t count)
     if (feof(stream)) {
       /* Program has closed stream (probably it exited) */
       /* TODO: check error */
-      return ST_CLOSED;
+      return IO_STREAM_CLOSED;
     } else {
       if (EAGAIN == errno) {
         /* Nothing more to read, try again next time */
-        return ST_EAGAIN;
+        return IO_STREAM_EAGAIN;
       } else {
         /* There was a problem, abandon this child process */
-        return ST_TERM;
+        return IO_STREAM_TERM;
       }
     }
   } else {
@@ -3175,11 +3175,11 @@ get_string_from_pipe(FILE *stream, char *buf_out, size_t count)
       buf_out[len - 1] = '\0';
     }
 
-    return ST_OKAY;
+    return IO_STREAM_OKAY;
   }
 
   /* We should never get here */
-  return ST_TERM;
+  return IO_STREAM_TERM;
 }
 
 /** Read from stream, and send lines to log at the specified log level.
diff --git a/src/common/util.h b/src/common/util.h
index 1b81fa3..12dc106 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -281,10 +281,10 @@ ssize_t read_all(tor_socket_t fd, char *buf, size_t count, int isSocket);
 
 /** Status of an I/O stream. */
 enum stream_status {
-  ST_OKAY,
-  ST_EAGAIN,
-  ST_TERM,
-  ST_CLOSED
+  IO_STREAM_OKAY,
+  IO_STREAM_EAGAIN,
+  IO_STREAM_TERM,
+  IO_STREAM_CLOSED
 };
 
 enum stream_status get_string_from_pipe(FILE *stream, char *buf, size_t count);
diff --git a/src/or/transports.c b/src/or/transports.c
index aae39cd..6589a8c 100644
--- a/src/or/transports.c
+++ b/src/or/transports.c
@@ -163,14 +163,14 @@ configure_proxy(managed_proxy_t *mp)
     r = get_string_from_pipe(mp->stdout, stdout_buf,
                              sizeof(stdout_buf) - 1);
 
-    if (r == ST_CLOSED || r == ST_TERM) {
+    if (r == IO_STREAM_CLOSED || r == IO_STREAM_TERM) {
       log_warn(LD_GENERAL, "Managed proxy stream closed. "
                "Most probably application stopped running");
       mp->conf_state = PT_PROTO_BROKEN;
-    } else if (r == ST_EAGAIN) {
+    } else if (r == IO_STREAM_EAGAIN) {
       return;
     } else {
-      tor_assert(r == ST_OKAY);
+      tor_assert(r == IO_STREAM_OKAY);
       handle_proxy_line(stdout_buf, mp);
     }
 





More information about the tor-commits mailing list