develooper Front page | perl.libwww | Postings from March 2001

HTML-Parser-3.19

From:
Gisle Aas
Date:
March 10, 2001 06:38
Subject:
HTML-Parser-3.19
Message ID:
lrsnkl7kqq.fsf@caliper.ActiveState.com
? HTML-Parser-3.19.tar.gz
Index: Changes
===================================================================
RCS file: /cvsroot/libwww-perl/html-parser/Changes,v
retrieving revision 2.74
retrieving revision 2.75
diff -u -p -u -r2.74 -r2.75
--- Changes	2001/02/25 04:45:10	2.74
+++ Changes	2001/03/10 04:25:57	2.75
@@ -1,3 +1,12 @@
+2001-03-09   Gisle Aas <gisle@ActiveState.com>
+
+     Release 3.19
+
+     Avoid the entity2char global.  That should make the module
+     more thread safe.   Patch by Gurusamy Sarathy <gsar@ActiveState.com>.
+
+
+
 2001-02-24   Gisle Aas <gisle@ActiveState.com>
 
      Release 3.18
Index: Parser.pm
===================================================================
RCS file: /cvsroot/libwww-perl/html-parser/Parser.pm,v
retrieving revision 2.124
retrieving revision 2.125
diff -u -p -u -r2.124 -r2.125
--- Parser.pm	2001/02/25 04:45:10	2.124
+++ Parser.pm	2001/03/10 04:25:57	2.125
@@ -9,7 +9,7 @@ package HTML::Parser;
 use strict;
 use vars qw($VERSION @ISA);
 
-$VERSION = '3.18';  # $Date: 2001/02/25 04:45:10 $
+$VERSION = '3.19';  # $Date: 2001/03/10 04:25:57 $
 
 require HTML::Entities;
 
Index: Parser.xs
===================================================================
RCS file: /cvsroot/libwww-perl/html-parser/Parser.xs,v
retrieving revision 2.98
retrieving revision 2.100
diff -u -p -u -r2.98 -r2.100
--- Parser.xs	2001/02/23 07:05:41	2.98
+++ Parser.xs	2001/03/10 04:25:57	2.100
@@ -1,4 +1,4 @@
-/* $Id: Parser.xs,v 2.98 2001/02/23 07:05:41 gisle Exp $
+/* $Id: Parser.xs,v 2.100 2001/03/10 04:25:57 gisle Exp $
  *
  * Copyright 1999-2000, Gisle Aas.
  * Copyright 1999-2000, Michael A. Chase.
@@ -80,9 +80,6 @@ newSVpvn(char *s, STRLEN len)
 
 #define EXTERN static /* Don't pollute */
 
-EXTERN
-HV* entity2char;            /* %HTML::Entities::entity2char */
-
 #include "hparser.h"
 #include "util.c"
 #include "hparser.c"
@@ -199,6 +196,7 @@ _alloc_pstate(self)
 
 	Newz(56, pstate, 1, PSTATE);
 	pstate->signature = P_SIGNATURE;
+	pstate->entity2char = perl_get_hv("HTML::Entities::entity2char", TRUE);
 
 	sv = newSViv(PTR2IV(pstate));
 	sv_magic(sv, 0, '~', 0, 0);
@@ -338,6 +336,7 @@ void
 decode_entities(...)
     PREINIT:
         int i;
+	HV *entity2char = perl_get_hv("HTML::Entities::entity2char", FALSE);
     PPCODE:
 	if (GIMME_V == G_SCALAR && items > 1)
             items = 1;
@@ -386,6 +385,3 @@ UNICODE_SUPPORT()
 
 
 MODULE = HTML::Parser		PACKAGE = HTML::Parser
-
-BOOT:
-    entity2char = perl_get_hv("HTML::Entities::entity2char", TRUE);
Index: hparser.c
===================================================================
RCS file: /cvsroot/libwww-perl/html-parser/hparser.c,v
retrieving revision 2.52
retrieving revision 2.53
diff -u -p -u -r2.52 -r2.53
--- hparser.c	2001/02/23 07:08:01	2.52
+++ hparser.c	2001/03/10 04:25:57	2.53
@@ -1,4 +1,4 @@
-/* $Id: hparser.c,v 2.52 2001/02/23 07:08:01 gisle Exp $
+/* $Id: hparser.c,v 2.53 2001/03/10 04:25:57 gisle Exp $
  *
  * Copyright 1999-2001, Gisle Aas
  * Copyright 1999-2000, Michael A. Chase
@@ -278,7 +278,7 @@ report_event(PSTATE* p_state,
 			    beg++; len -= 2;
 			}
 			attrval = newSVpvn(beg, len);
-			decode_entities(aTHX_ attrval, entity2char);
+			decode_entities(aTHX_ attrval, p_state->entity2char);
 		    }
 		    else { /* boolean */
 			if (p_state->bool_attr_val)
@@ -321,7 +321,7 @@ report_event(PSTATE* p_state,
 	    if (event == E_TEXT) {
 		arg = sv_2mortal(newSVpvn(beg, end - beg));
 		if (!p_state->is_cdata)
-		    decode_entities(aTHX_ arg, entity2char);
+		    decode_entities(aTHX_ arg, p_state->entity2char);
 	    }
 	    break;
       
Index: hparser.h
===================================================================
RCS file: /cvsroot/libwww-perl/html-parser/hparser.h,v
retrieving revision 2.12
retrieving revision 2.13
diff -u -p -u -r2.12 -r2.13
--- hparser.h	2001/02/23 07:08:01	2.12
+++ hparser.h	2001/03/10 04:25:57	2.13
@@ -1,4 +1,4 @@
-/* $Id: hparser.h,v 2.12 2001/02/23 07:08:01 gisle Exp $
+/* $Id: hparser.h,v 2.13 2001/03/10 04:25:57 gisle Exp $
  *
  * Copyright 1999-2000, Gisle Aas
  * Copyright 1999-2000, Michael A. Chase
@@ -89,6 +89,9 @@ struct p_state {
     /* other configuration stuff */
     SV* bool_attr_val;
     struct p_handler handlers[EVENT_COUNT];
+
+    /* cache */
+    HV* entity2char;            /* %HTML::Entities::entity2char */
 };
 typedef struct p_state PSTATE;
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About