[svn-commits] murf: branch group/mime r61639 - in /team/group/mime/main: ./ minimime/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Apr 13 06:51:12 MST 2007


Author: murf
Date: Fri Apr 13 08:51:11 2007
New Revision: 61639

URL: http://svn.digium.com/view/asterisk?view=rev&rev=61639
Log:
OK, All this to prevent 27 bytes of leakage per invocation; I fixed the call to register the codecs to be made after the context is created in http.c; I free the codecs in the context free routine; I fixed up the codec free routines to not violate memory.

Modified:
    team/group/mime/main/http.c
    team/group/mime/main/minimime/mimeparser.tab.c
    team/group/mime/main/minimime/mimeparser.tab.h
    team/group/mime/main/minimime/mimeparser.y
    team/group/mime/main/minimime/mimeparser.yy.c
    team/group/mime/main/minimime/mm_codecs.c
    team/group/mime/main/minimime/mm_context.c
    team/group/mime/main/minimime/mm_queue.h

Modified: team/group/mime/main/http.c
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/http.c?view=diff&rev=61639&r1=61638&r2=61639
==============================================================================
--- team/group/mime/main/http.c (original)
+++ team/group/mime/main/http.c Fri Apr 13 08:51:11 2007
@@ -502,7 +502,7 @@
 		fclose(f);
 		return NULL;
 	}
-
+	mm_codec_registerdefaultcodecs(ctx);
 	mm_res = mm_parse_fileptr(ctx, f, MM_PARSE_LOOSE, 0);
 	fclose(f);
 	if (mm_res == -1) {
@@ -1314,8 +1314,6 @@
 
 int ast_http_init(void)
 {
-	mm_library_init();
-	mm_codec_registerdefaultcodecs();
 
 	ast_http_uri_link(&statusuri);
 	ast_http_uri_link(&staticuri);

Modified: team/group/mime/main/minimime/mimeparser.tab.c
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mimeparser.tab.c?view=diff&rev=61639&r1=61638&r2=61639
==============================================================================
--- team/group/mime/main/minimime/mimeparser.tab.c (original)
+++ team/group/mime/main/minimime/mimeparser.tab.c Fri Apr 13 08:51:11 2007
@@ -1,9 +1,7 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
-
-/* Skeleton implementation for Bison's Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
+/* A Bison parser, made by GNU Bison 2.1a.  */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,18 +18,10 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.  */
 
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
 
 /* C LALR(1) parser skeleton written by Richard Stallman, by
    simplifying the original so-called "semantic" parser.  */
@@ -47,7 +37,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.1a"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -168,6 +158,7 @@
  *	- parse Content-Disposition header (partly done)
  *	- parse Content-Encoding header
  */
+#define _GNU_SOURCE 1
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
@@ -211,14 +202,14 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 69 "mimeparser.y"
+#line 70 "mimeparser.y"
 {
 	int number;
 	char *string;
 	struct s_position position;
 }
-/* Line 193 of yacc.c.  */
-#line 222 "mimeparser.tab.c"
+/* Line 198 of yacc.c.  */
+#line 213 "mimeparser.tab.c"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -230,8 +221,8 @@
 /* Copy the second part of user declarations.  */
 
 
-/* Line 216 of yacc.c.  */
-#line 235 "mimeparser.tab.c"
+/* Line 221 of yacc.c.  */
+#line 226 "mimeparser.tab.c"
 
 #ifdef short
 # undef short
@@ -361,13 +352,8 @@
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
 #  endif
-#  if (defined __cplusplus && ! defined _STDLIB_H \
-       && ! ((defined YYMALLOC || defined malloc) \
-	     && (defined YYFREE || defined free)))
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef _STDLIB_H
-#    define _STDLIB_H 1
-#   endif
+#  ifdef __cplusplus
+extern "C" {
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
@@ -382,6 +368,9 @@
      || defined __cplusplus || defined _MSC_VER)
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
+#  endif
+#  ifdef __cplusplus
+}
 #  endif
 # endif
 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
@@ -534,12 +523,12 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   114,   114,   126,   139,   138,   151,   160,   162,   186,
-     190,   205,   209,   212,   216,   218,   222,   237,   239,   249,
-     251,   253,   255,   269,   278,   298,   307,   318,   326,   336,
-     359,   368,   376,   380,   382,   386,   400,   402,   404,   418,
-     420,   422,   436,   467,   481,   487,   502,   510,   517,   539,
-     559
+       0,   115,   115,   127,   140,   139,   152,   161,   163,   187,
+     191,   206,   210,   213,   217,   219,   223,   238,   240,   250,
+     252,   254,   256,   270,   279,   299,   308,   319,   327,   337,
+     360,   369,   377,   381,   383,   387,   401,   403,   405,   419,
+     421,   423,   437,   468,   482,   488,   503,   511,   518,   540,
+     560
 };
 #endif
 
@@ -812,13 +801,13 @@
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parser_state *pstate, void *yyscanner)
+yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, struct parser_state *pstate, void *yyscanner)
 #else
 static void
 yy_symbol_value_print (yyoutput, yytype, yyvaluep, pstate, yyscanner)
     FILE *yyoutput;
     int yytype;
-    YYSTYPE const * const yyvaluep;
+    const YYSTYPE * const yyvaluep;
     struct parser_state *pstate;
     void *yyscanner;
 #endif
@@ -848,13 +837,13 @@
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parser_state *pstate, void *yyscanner)
+yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, struct parser_state *pstate, void *yyscanner)
 #else
 static void
 yy_symbol_print (yyoutput, yytype, yyvaluep, pstate, yyscanner)
     FILE *yyoutput;
     int yytype;
-    YYSTYPE const * const yyvaluep;
+    const YYSTYPE * const yyvaluep;
     struct parser_state *pstate;
     void *yyscanner;
 #endif
@@ -904,12 +893,14 @@
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct parser_state *pstate, void *yyscanner)
+yy_reduce_print (YYSTYPE *yyvsp, 
+		   int yyrule, struct parser_state *pstate, void *yyscanner)
 #else
 static void
 yy_reduce_print (yyvsp, yyrule, pstate, yyscanner)
     YYSTYPE *yyvsp;
-    int yyrule;
+    
+		   int yyrule;
     struct parser_state *pstate;
     void *yyscanner;
 #endif
@@ -1031,7 +1022,7 @@
 {
   if (*yystr == '"')
     {
-      YYSIZE_T yyn = 0;
+      size_t yyn = 0;
       char const *yyp = yystr;
 
       for (;;)
@@ -1078,7 +1069,7 @@
 {
   int yyn = yypact[yystate];
 
-  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+  if (! (YYPACT_NINF < yyn && yyn < YYLAST))
     return 0;
   else
     {
@@ -1116,7 +1107,7 @@
       int yyxbegin = yyn < 0 ? -yyn : 0;
 
       /* Stay within bounds of both yycheck and yytname.  */
-      int yychecklim = YYLAST - yyn + 1;
+      int yychecklim = YYLAST - yyn;
       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
       int yycount = 1;
 
@@ -1513,7 +1504,7 @@
   switch (yyn)
     {
         case 2:
-#line 115 "mimeparser.y"
+#line 116 "mimeparser.y"
     {
 		if (pstate->ctype)
 			mm_content_free(pstate->ctype);
@@ -1527,7 +1518,7 @@
     break;
 
   case 3:
-#line 127 "mimeparser.y"
+#line 128 "mimeparser.y"
     {
 		if (pstate->ctype)
 			mm_content_free(pstate->ctype);
@@ -1539,7 +1530,7 @@
     break;
 
   case 4:
-#line 139 "mimeparser.y"
+#line 140 "mimeparser.y"
     { 
 		mm_context_attachpart(pstate->ctx, pstate->current_mimepart);
 		pstate->current_mimepart = mm_mimepart_new();
@@ -1548,14 +1539,14 @@
     break;
 
   case 5:
-#line 145 "mimeparser.y"
+#line 146 "mimeparser.y"
     {
 		dprintf2(pstate,"This was a multipart message\n");
 	;}
     break;
 
   case 6:
-#line 152 "mimeparser.y"
+#line 153 "mimeparser.y"
     {
 		dprintf2(pstate,"This was a single part message\n");
 		mm_context_attachpart(pstate->ctx, pstate->current_mimepart);
@@ -1564,7 +1555,7 @@
     break;
 
   case 8:
-#line 163 "mimeparser.y"
+#line 164 "mimeparser.y"
     {
 		/* If we did not find a Content-Type header for the current
 		 * MIME part (or envelope), we create one and attach it.
@@ -1590,7 +1581,7 @@
     break;
 
   case 10:
-#line 191 "mimeparser.y"
+#line 192 "mimeparser.y"
     {
 		char *preamble;
 		size_t offset;
@@ -1608,13 +1599,13 @@
     break;
 
   case 12:
-#line 210 "mimeparser.y"
+#line 211 "mimeparser.y"
     {
 	;}
     break;
 
   case 16:
-#line 223 "mimeparser.y"
+#line 224 "mimeparser.y"
     {
 
 		if (mm_context_attachpart(pstate->ctx, pstate->current_mimepart) == -1) {
@@ -1629,7 +1620,7 @@
     break;
 
   case 18:
-#line 240 "mimeparser.y"
+#line 241 "mimeparser.y"
     {
 		pstate->have_contenttype = 1;
 		if (mm_content_iscomposite(pstate->envelope->type)) {
@@ -1641,7 +1632,7 @@
     break;
 
   case 22:
-#line 256 "mimeparser.y"
+#line 257 "mimeparser.y"
     {
 		if (pstate->parsemode != MM_PARSE_LOOSE) {
 			pstate->ctx->mm_errno = MM_ERROR_PARSE;
@@ -1655,7 +1646,7 @@
     break;
 
   case 23:
-#line 270 "mimeparser.y"
+#line 271 "mimeparser.y"
     {
 		struct mm_mimeheader *hdr;
 		hdr = mm_mimeheader_generate((yyvsp[(1) - (4)].string), (yyvsp[(3) - (4)].string));
@@ -1666,7 +1657,7 @@
     break;
 
   case 24:
-#line 279 "mimeparser.y"
+#line 280 "mimeparser.y"
     {
 		struct mm_mimeheader *hdr;
 
@@ -1686,7 +1677,7 @@
     break;
 
   case 25:
-#line 299 "mimeparser.y"
+#line 300 "mimeparser.y"
     {
 		mm_content_settype(pstate->ctype, "%s", (yyvsp[(3) - (4)].string));
 		mm_mimepart_attachcontenttype(pstate->current_mimepart, pstate->ctype);
@@ -1697,7 +1688,7 @@
     break;
 
   case 26:
-#line 308 "mimeparser.y"
+#line 309 "mimeparser.y"
     {
 		mm_content_settype(pstate->ctype, "%s", (yyvsp[(3) - (5)].string));
 		mm_mimepart_attachcontenttype(pstate->current_mimepart, pstate->ctype);
@@ -1708,7 +1699,7 @@
     break;
 
   case 27:
-#line 319 "mimeparser.y"
+#line 320 "mimeparser.y"
     {
 		dprintf2(pstate,"Content-Disposition -> %s\n", (yyvsp[(3) - (4)].string));
 		if (pstate->ctype->disposition_type)
@@ -1718,7 +1709,7 @@
     break;
 
   case 28:
-#line 327 "mimeparser.y"
+#line 328 "mimeparser.y"
     {
 		dprintf2(pstate,"Content-Disposition (P) -> %s; params\n", (yyvsp[(3) - (5)].string));
 		if (pstate->ctype->disposition_type)
@@ -1728,7 +1719,7 @@
     break;
 
   case 29:
-#line 337 "mimeparser.y"
+#line 338 "mimeparser.y"
     {
 		/*
 		 * According to RFC 2183, the content disposition value may
@@ -1751,7 +1742,7 @@
     break;
 
   case 30:
-#line 360 "mimeparser.y"
+#line 361 "mimeparser.y"
     {
 		dprintf2(pstate,"Content-Transfer-Encoding -> %s\n", (yyvsp[(3) - (4)].string));
 		free((yyvsp[(3) - (4)].string)); /* until we use this */
@@ -1760,7 +1751,7 @@
     break;
 
   case 31:
-#line 369 "mimeparser.y"
+#line 370 "mimeparser.y"
     {
 		dprintf2(pstate,"MIME-Version -> '%s'\n", (yyvsp[(3) - (4)].string));
 		free((yyvsp[(3) - (4)].string)); /* until we use this */
@@ -1768,7 +1759,7 @@
     break;
 
   case 35:
-#line 387 "mimeparser.y"
+#line 388 "mimeparser.y"
     {
 		char *combo;
 		combo = xmalloc(strlen((yyvsp[(1) - (3)].string))+strlen((yyvsp[(3) - (3)].string))+2);
@@ -1782,7 +1773,7 @@
     break;
 
   case 38:
-#line 405 "mimeparser.y"
+#line 406 "mimeparser.y"
     {
 		if (pstate->parsemode != MM_PARSE_LOOSE) {
 			pstate->ctx->mm_errno = MM_ERROR_MIME;
@@ -1796,7 +1787,7 @@
     break;
 
   case 41:
-#line 423 "mimeparser.y"
+#line 424 "mimeparser.y"
     {	
 		if (pstate->parsemode != MM_PARSE_LOOSE) {
 			pstate->ctx->mm_errno = MM_ERROR_MIME;
@@ -1810,7 +1801,7 @@
     break;
 
   case 42:
-#line 437 "mimeparser.y"
+#line 438 "mimeparser.y"
     {
 		struct mm_param *param;
 		param = mm_param_new();
@@ -1841,7 +1832,7 @@
     break;
 
   case 43:
-#line 468 "mimeparser.y"
+#line 469 "mimeparser.y"
     {
 		struct mm_param *param;
 		param = mm_param_new();
@@ -1855,7 +1846,7 @@
     break;
 
   case 44:
-#line 482 "mimeparser.y"
+#line 483 "mimeparser.y"
     {
 		dprintf2(pstate,"contenttype_param_val: WORD=%s\n", (yyvsp[(1) - (1)].string));
 		(yyval.string) = (yyvsp[(1) - (1)].string);
@@ -1863,7 +1854,7 @@
     break;
 
   case 45:
-#line 488 "mimeparser.y"
+#line 489 "mimeparser.y"
     {
 		dprintf2(pstate,"contenttype_param_val: TSPECIAL\n");
 		/* For broken MIME implementation */
@@ -1880,7 +1871,7 @@
     break;
 
   case 46:
-#line 503 "mimeparser.y"
+#line 504 "mimeparser.y"
     {
 		dprintf2(pstate,"contenttype_param_val: \"TSPECIAL\"\n" );
 		(yyval.string) = (yyvsp[(2) - (3)].string);
@@ -1888,14 +1879,14 @@
     break;
 
   case 47:
-#line 511 "mimeparser.y"
+#line 512 "mimeparser.y"
     {
 		dprintf2(pstate,"End of headers at line %d\n", pstate->lstate.lineno);
 	;}
     break;
 
   case 48:
-#line 518 "mimeparser.y"
+#line 519 "mimeparser.y"
     {
 		if (pstate->lstate.boundary_string == NULL) {
 			pstate->ctx->mm_errno = MM_ERROR_PARSE;
@@ -1917,7 +1908,7 @@
     break;
 
   case 49:
-#line 540 "mimeparser.y"
+#line 541 "mimeparser.y"
     {
 		if (pstate->lstate.endboundary_string == NULL) {
 			pstate->ctx->mm_errno = MM_ERROR_PARSE;
@@ -1937,7 +1928,7 @@
     break;
 
   case 50:
-#line 560 "mimeparser.y"
+#line 561 "mimeparser.y"
     {
 		char *body;
 		size_t offset;
@@ -1958,8 +1949,8 @@
     break;
 
 
-/* Line 1267 of yacc.c.  */
-#line 1963 "mimeparser.tab.c"
+/* Line 1270 of yacc.c.  */
+#line 1954 "mimeparser.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2168,12 +2159,11 @@
   if (yymsg != yymsgbuf)
     YYSTACK_FREE (yymsg);
 #endif
-  /* Make sure YYID is used.  */
-  return YYID (yyresult);
+  return yyresult;
 }
 
 
-#line 579 "mimeparser.y"
+#line 580 "mimeparser.y"
 
 
 /*

Modified: team/group/mime/main/minimime/mimeparser.tab.h
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mimeparser.tab.h?view=diff&rev=61639&r1=61638&r2=61639
==============================================================================
--- team/group/mime/main/minimime/mimeparser.tab.h (original)
+++ team/group/mime/main/minimime/mimeparser.tab.h Fri Apr 13 08:51:11 2007
@@ -1,9 +1,7 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
+/* A Bison parser, made by GNU Bison 2.1a.  */
 
-/* Skeleton interface for Bison's Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
+/* Skeleton parser for Yacc-like parsing with Bison,
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,18 +18,10 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.  */
 
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
 
 /* Tokens.  */
 #ifndef YYTOKENTYPE
@@ -94,14 +84,14 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 69 "mimeparser.y"
+#line 70 "mimeparser.y"
 {
 	int number;
 	char *string;
 	struct s_position position;
 }
-/* Line 1529 of yacc.c.  */
-#line 105 "mimeparser.tab.h"
+/* Line 1536 of yacc.c.  */
+#line 95 "mimeparser.tab.h"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -110,3 +100,5 @@
 
 
 
+
+

Modified: team/group/mime/main/minimime/mimeparser.y
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mimeparser.y?view=diff&rev=61639&r1=61638&r2=61639
==============================================================================
--- team/group/mime/main/minimime/mimeparser.y (original)
+++ team/group/mime/main/minimime/mimeparser.y Fri Apr 13 08:51:11 2007
@@ -37,6 +37,7 @@
  *	- parse Content-Disposition header (partly done)
  *	- parse Content-Encoding header
  */
+#define _GNU_SOURCE 1
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>

Modified: team/group/mime/main/minimime/mimeparser.yy.c
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mimeparser.yy.c?view=diff&rev=61639&r1=61638&r2=61639
==============================================================================
--- team/group/mime/main/minimime/mimeparser.yy.c (original)
+++ team/group/mime/main/minimime/mimeparser.yy.c Fri Apr 13 08:51:11 2007
@@ -647,11 +647,13 @@
 #define endboundary 11
 #define endoffile 12
 
+#ifndef YY_NO_UNISTD_H
 /* Special case for "unistd.h", since it is non-ANSI. We include it way
  * down here because we want the user's section 1 to have been scanned first.
  * The user has a chance to override it with an option.
  */
 #include <unistd.h>
+#endif
 
 #ifndef YY_EXTRA_TYPE
 #define YY_EXTRA_TYPE void *
@@ -692,6 +694,8 @@
     YYSTYPE * yylval_r;
 
     }; /* end struct yyguts_t */
+
+static int yy_init_globals (yyscan_t yyscanner );
 
     /* This must go here because YYSTYPE and YYLTYPE are included
      * from bison output in section 1.*/
@@ -837,9 +841,11 @@
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int mimeparser_yylex (YYSTYPE * yylval_param ,yyscan_t yyscanner);
-
-#define YY_DECL int mimeparser_yylex (YYSTYPE * yylval_param , yyscan_t yyscanner)
+extern int mimeparser_yylex \
+               (YYSTYPE * yylval_param ,yyscan_t yyscanner);
+
+#define YY_DECL int mimeparser_yylex \
+               (YYSTYPE * yylval_param , yyscan_t yyscanner)
 #endif /* !YY_DECL */
 
 /* Code executed at the beginning of each rule, after yytext and yyleng
@@ -872,7 +878,7 @@
 #line 98 "mimeparser.l"
 
 
-#line 876 "mimeparser.yy.c"
+#line 882 "mimeparser.yy.c"
 
     yylval = yylval_param;
 
@@ -1405,7 +1411,7 @@
 #line 428 "mimeparser.l"
 ECHO;
 	YY_BREAK
-#line 1409 "mimeparser.yy.c"
+#line 1415 "mimeparser.yy.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(headers):
 case YY_STATE_EOF(header):
@@ -1603,7 +1609,7 @@
 
 	else
 		{
-			size_t num_to_read =
+			int num_to_read =
 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
 		while ( num_to_read <= 0 )
@@ -2181,10 +2187,10 @@
  * @note If you want to scan bytes that may contain NUL values, then use
  *       mimeparser_yy_scan_bytes() instead.
  */
-YY_BUFFER_STATE mimeparser_yy_scan_string (yyconst char * str , yyscan_t yyscanner)
+YY_BUFFER_STATE mimeparser_yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner)
 {
     
-	return mimeparser_yy_scan_bytes(str,strlen(str) ,yyscanner);
+	return mimeparser_yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner);
 }
 
 /** Setup the input buffer state to scan the given bytes. The next call to mimeparser_yylex() will

Modified: team/group/mime/main/minimime/mm_codecs.c
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mm_codecs.c?view=diff&rev=61639&r1=61638&r2=61639
==============================================================================
--- team/group/mime/main/minimime/mm_codecs.c (original)
+++ team/group/mime/main/minimime/mm_codecs.c Fri Apr 13 08:51:11 2007
@@ -197,6 +197,7 @@
 
 	SLIST_FOREACH(codec, &ctx->codecs, next) {
 		if (!strcasecmp(codec->encoding, encoding)) {
+			SLIST_REMOVE(&ctx->codecs, codec, mm_codec, next);
 			xfree(codec->encoding);
 			xfree(codec);
 			codec = NULL;
@@ -218,12 +219,13 @@
 int
 mm_codec_unregisterall(MM_CTX *ctx) 
 {
-	struct mm_codec *codec;
-
-	SLIST_FOREACH(codec, &ctx->codecs, next) {
-		if (mm_codec_unregister(ctx, codec->encoding) == -1) {
-			return -1;
-		}
+	struct mm_codec *codec, *codec_next;
+
+	SLIST_FOREACH_SAFE(codec, codec_next, &ctx->codecs, next) {
+		codec_next = SLIST_NEXT(codec, next);
+		SLIST_REMOVE(&ctx->codecs, codec, mm_codec, next);
+		xfree(codec->encoding);
+		xfree(codec);
 	}
 
 	return 0;

Modified: team/group/mime/main/minimime/mm_context.c
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mm_context.c?view=diff&rev=61639&r1=61638&r2=61639
==============================================================================
--- team/group/mime/main/minimime/mm_context.c (original)
+++ team/group/mime/main/minimime/mm_context.c Fri Apr 13 08:51:11 2007
@@ -134,7 +134,7 @@
 		xfree(warning);
 		warning = NULL;
 	}
-
+	mm_codec_unregisterall(ctx);
 	xfree(ctx);
 	ctx = NULL;
 }

Modified: team/group/mime/main/minimime/mm_queue.h
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mm_queue.h?view=diff&rev=61639&r1=61638&r2=61639
==============================================================================
--- team/group/mime/main/minimime/mm_queue.h (original)
+++ team/group/mime/main/minimime/mm_queue.h Fri Apr 13 08:51:11 2007
@@ -111,6 +111,11 @@
 	    (var) != SLIST_END(head);					\
 	    (var) = SLIST_NEXT(var, field))
 
+#define	SLIST_FOREACH_SAFE(var, varinc, head, field)	\
+	for((var) = SLIST_FIRST(head);					\
+	    (var) != SLIST_END(head);					\
+	    (var) = varinc)
+
 #define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\
 	for ((varp) = &SLIST_FIRST((head));				\
 	    ((var) = *(varp)) != SLIST_END(head);			\



More information about the svn-commits mailing list