Browse code

Remove function replace_len which is no longer needed.

This function was originally used to calculate the size of the memory
buffer in replace_build for the resulting string. Since we now print
the result into a static buffer, this function is no longer needed.

Jan Janak authored on 08/03/2009 03:42:10
Showing 1 changed files
... ...
@@ -328,52 +328,6 @@ error:
328 328
 	return 0;
329 329
 }
330 330
 
331
-
332
-
333
-static int replace_len(const char* match, int nmatch, regmatch_t* pmatch,
334
-					struct subst_expr* se, struct sip_msg* msg)
335
-{
336
-	int r;
337
-	int len;
338
-	str* uri;
339
-	
340
-	len=se->replacement.len;
341
-	for (r=0; r<se->n_escapes; r++){
342
-		switch(se->replace[r].type){
343
-			case REPLACE_NMATCH:
344
-				len-=se->replace[r].size;
345
-				if ((se->replace[r].u.nmatch<nmatch)&&(
346
-						pmatch[se->replace[r].u.nmatch].rm_so!=-1)){
347
-						/* do the replace */
348
-						len+=pmatch[se->replace[r].u.nmatch].rm_eo-
349
-								pmatch[se->replace[r].u.nmatch].rm_so;
350
-				};
351
-				break;
352
-			case REPLACE_CHAR:
353
-				len-=(se->replace[r].size-1);
354
-				break;
355
-			case REPLACE_URI:
356
-				len-=se->replace[r].size;
357
-				if (msg->first_line.type!=SIP_REQUEST){
358
-					LOG(L_CRIT, "BUG: replace_len: uri substitution on"
359
-								" a reply\n");
360
-					break; /* ignore, we can continue */
361
-				}
362
-				uri= (msg->new_uri.s)?(&msg->new_uri):
363
-					(&msg->first_line.u.request.uri);
364
-				len+=uri->len;
365
-				break;
366
-			default:
367
-				LOG(L_CRIT, "BUG: replace_len: unknown type %d\n", 
368
-						se->replace[r].type);
369
-				/* ignore it */
370
-		}
371
-	}
372
-	return len;
373
-}
374
-
375
-
376
-
377 331
 /* rpl.s will be alloc'ed with the proper size & rpl.len set
378 332
  * returns 0 on success, <0 on error*/
379 333
 static int replace_build(const char* match, int nmatch, regmatch_t* pmatch,