[asterisk-commits] trunk r18790 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Apr 10 04:19:16 MST 2006


Author: rizzo
Date: Mon Apr 10 06:19:14 2006
New Revision: 18790

URL: http://svn.digium.com/view/asterisk?rev=18790&view=rev
Log:
constify get_sdp*() and friends.


Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=18790&r1=18789&r2=18790&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Apr 10 06:19:14 2006
@@ -990,7 +990,7 @@
 static void sip_destroy_peer(struct sip_peer *peer);
 static void sip_destroy_user(struct sip_user *user);
 static void parse_request(struct sip_request *req);
-static const char *get_header(struct sip_request *req, const char *name);
+static const char *get_header(const struct sip_request *req, const char *name);
 static void copy_request(struct sip_request *dst,struct sip_request *src);
 static int transmit_response_reliable(struct sip_pvt *p, char *msg, struct sip_request *req);
 static int transmit_register(struct sip_registry *r, int sipmethod, char *auth, char *authheader);
@@ -2963,23 +2963,22 @@
 }
 
 /*! \brief Reads one line of SIP message body */
-static char* get_sdp_by_line(char* line, char *name, int nameLen)
-{
-	if (strncasecmp(line, name, nameLen) == 0 && line[nameLen] == '=') {
+static const char* get_sdp_by_line(const char* line, const char *name, int nameLen)
+{
+	if (strncasecmp(line, name, nameLen) == 0 && line[nameLen] == '=')
 		return ast_skip_blanks(line + nameLen + 1);
-	}
 	return "";
 }
 
 /*! \brief Gets all kind of SIP message bodies, including SDP,
    but the name wrongly applies _only_ sdp */
-static char *get_sdp(struct sip_request *req, char *name) 
+static const char *get_sdp(struct sip_request *req, char *name) 
 {
 	int x;
 	int len = strlen(name);
 
 	for (x = 0; x < req->lines; x++) {
-		char *r = get_sdp_by_line(req->line[x], name, len);
+		const char *r = get_sdp_by_line(req->line[x], name, len);
 		if (r[0] != '\0')
 			return r;
 	}
@@ -2992,13 +2991,13 @@
 	*iterator = 0;
 }
 
-static char* get_sdp_iterate(int* iterator,
+static const char* get_sdp_iterate(int* iterator,
 			     struct sip_request *req, char *name)
 {
 	int len = strlen(name);
 
 	while (*iterator < req->lines) {
-		char *r = get_sdp_by_line(req->line[(*iterator)++], name, len);
+		const char *r = get_sdp_by_line(req->line[(*iterator)++], name, len);
 		if (r[0] != '\0')
 			return r;
 	}
@@ -3014,7 +3013,7 @@
 	return _default;
 }
 
-static const char *__get_header(struct sip_request *req, const char *name, int *start)
+static const char *__get_header(const struct sip_request *req, const char *name, int *start)
 {
 	int pass;
 
@@ -3050,7 +3049,7 @@
 }
 
 /*! \brief Get header from SIP request */
-static const char *get_header(struct sip_request *req, const char *name)
+static const char *get_header(const struct sip_request *req, const char *name)
 {
 	int start = 0;
 	return __get_header(req, name, &start);
@@ -3528,9 +3527,9 @@
 /*! \brief Process SIP SDP and activate RTP channels*/
 static int process_sdp(struct sip_pvt *p, struct sip_request *req)
 {
-	char *m;
-	char *c;
-	char *a;
+	const char *m;
+	const char *c;
+	const char *a;
 	char host[258];
 	char iabuf[INET_ADDRSTRLEN];
 	int len = -1;
@@ -3539,7 +3538,7 @@
 	int peercapability, peernoncodeccapability;
 	int vpeercapability=0, vpeernoncodeccapability=0;
 	struct sockaddr_in sin;
-	char *codecs;
+	const char *codecs;
 	struct hostent *hp;
 	struct ast_hostent ahp;
 	int codec;



More information about the asterisk-commits mailing list