]> granicus.if.org Git - curl/commitdiff
RTSP: cleanups
authorDaniel Stenberg <daniel@haxx.se>
Thu, 5 May 2011 14:53:05 +0000 (16:53 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 5 May 2011 14:53:05 +0000 (16:53 +0200)
Made several functions static

Made one function defined to nothing when RTSP is disabled to avoid
the #ifdefs in code.

Removed explicit rtsp.h includes

lib/http.c
lib/rtsp.c
lib/rtsp.h
lib/sendf.c
lib/transfer.c
lib/url.c

index cc8dcffa58686d23e80f435a9a3613712c929058..fe78b6dc3c5515bff2b3a0782ea836c995b680bd 100644 (file)
@@ -96,7 +96,6 @@
 #include "multiif.h"
 #include "rawstr.h"
 #include "content_encoding.h"
-#include "rtsp.h"
 #include "http_proxy.h"
 #include "warnless.h"
 #include "non-ascii.h"
@@ -3314,13 +3313,12 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
         }
       }
     }
-#ifndef CURL_DISABLE_RTSP
     else if(conn->handler->protocol & CURLPROTO_RTSP) {
       result = Curl_rtsp_parseheader(conn, k->p);
       if(result)
         return result;
     }
-#endif
+
     /*
      * End of header-checks. Write them to the client.
      */
index 9e55f30c7d8b57a05a435f882621bcb8330ce284..3ce8ad51e7860a6c322eb8726ea517d35530ada5 100644 (file)
 #define RTP_PKT_LENGTH(p)  ((((int)((unsigned char)((p)[2]))) << 8) | \
                              ((int)((unsigned char)((p)[3]))))
 
+/* protocol-specific functions set up to be called by the main engine */
+static CURLcode rtsp_do(struct connectdata *conn, bool *done);
+static CURLcode rtsp_done(struct connectdata *conn, CURLcode, bool premature);
+static CURLcode rtsp_connect(struct connectdata *conn, bool *done);
+static CURLcode rtsp_disconnect(struct connectdata *conn, bool dead);
+
 static int rtsp_getsock_do(struct connectdata *conn,
                            curl_socket_t *socks,
                            int numsocks);
@@ -99,16 +105,16 @@ CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len);
 const struct Curl_handler Curl_handler_rtsp = {
   "RTSP",                               /* scheme */
   ZERO_NULL,                            /* setup_connection */
-  Curl_rtsp,                            /* do_it */
-  Curl_rtsp_done,                       /* done */
+  rtsp_do,                              /* do_it */
+  rtsp_done,                            /* done */
   ZERO_NULL,                            /* do_more */
-  Curl_rtsp_connect,                    /* connect_it */
+  rtsp_connect,                         /* connect_it */
   ZERO_NULL,                            /* connecting */
   ZERO_NULL,                            /* doing */
   ZERO_NULL,                            /* proto_getsock */
   rtsp_getsock_do,                      /* doing_getsock */
   ZERO_NULL,                            /* perform_getsock */
-  Curl_rtsp_disconnect,                 /* disconnect */
+  rtsp_disconnect,                      /* disconnect */
   rtsp_rtp_readwrite,                   /* readwrite */
   PORT_RTSP,                            /* defport */
   CURLPROTO_RTSP,                       /* protocol */
@@ -148,7 +154,7 @@ bool Curl_rtsp_connisdead(struct connectdata *check)
   return ret_val;
 }
 
-CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done)
+static CURLcode rtsp_connect(struct connectdata *conn, bool *done)
 {
   CURLcode httpStatus;
   struct SessionHandle *data = conn->data;
@@ -166,16 +172,16 @@ CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done)
   return httpStatus;
 }
 
-CURLcode Curl_rtsp_disconnect(struct connectdata *conn, bool dead_connection)
+static CURLcode rtsp_disconnect(struct connectdata *conn, bool dead)
 {
-  (void) dead_connection;
+  (void) dead;
   Curl_safefree(conn->proto.rtspc.rtp_buf);
   return CURLE_OK;
 }
 
 
-CURLcode Curl_rtsp_done(struct connectdata *conn,
-                        CURLcode status, bool premature)
+static CURLcode rtsp_done(struct connectdata *conn,
+                          CURLcode status, bool premature)
 {
   struct SessionHandle *data = conn->data;
   struct RTSP *rtsp = data->state.proto.rtsp;
@@ -209,7 +215,7 @@ CURLcode Curl_rtsp_done(struct connectdata *conn,
   return httpStatus;
 }
 
-CURLcode Curl_rtsp(struct connectdata *conn, bool *done)
+static CURLcode rtsp_do(struct connectdata *conn, bool *done)
 {
   struct SessionHandle *data = conn->data;
   CURLcode result=CURLE_OK;
index 93016be7af2dfd58527248a0526261245f447664..08b8b5cbfef8e1ab93782c4a5ec5c47c38829500 100644 (file)
 
 extern const struct Curl_handler Curl_handler_rtsp;
 
-/* protocol-specific functions set up to be called by the main engine */
-CURLcode Curl_rtsp(struct connectdata *conn, bool *done);
-CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature);
-CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done);
-CURLcode Curl_rtsp_disconnect(struct connectdata *conn, bool dead_connection);
-
-CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header);
 bool Curl_rtsp_connisdead(struct connectdata *check);
+CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header);
 
 #else
 /* disabled */
+#define Curl_rtsp_parseheader(x,y) CURLE_NOT_BUILT_IN
 #define Curl_rtsp_connisdead(x) TRUE
 
 #endif /* CURL_DISABLE_RTSP */
index 3e71e1dc5b610fbeb5aa0dbaf720f77b248b34ec..c984d2a500943ad93528acbf5919f417e8ea2c92 100644 (file)
@@ -42,7 +42,6 @@
 #include "sslgen.h"
 #include "ssh.h"
 #include "multiif.h"
-#include "rtsp.h"
 #include "non-ascii.h"
 
 #define _MPRINTF_REPLACE /* use the internal *printf() functions */
index 87a03aa86ec6c08ec5b65a2184e89fd56addca9b..69064d999c611a35f20d01582af221368e1bf0c6 100644 (file)
 #include "curl_memory.h"
 #include "select.h"
 #include "multiif.h"
-#include "rtsp.h"
 #include "connect.h"
 #include "non-ascii.h"
 
index 6a3d81aaf64696b8b662aa8575a4fd9abc51f5e2..4771b3b973a4e16117cd24fcf863a949c45230a1 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -139,7 +139,6 @@ int curl_win32_idn_to_ascii(const char *in, char **out);
 #include "inet_ntop.h"
 #include "http_ntlm.h"
 #include "socks.h"
-#include "rtsp.h"
 #include "curl_rtmp.h"
 #include "gopher.h"