mirror of
				https://gitlab.gnome.org/GNOME/libxslt
				synced 2025-11-04 00:53:12 +03:00 
			
		
		
		
	* libexslt/date.c: patch from Charles Bozeman fixing a memory leak in exsltDateDurationFunction pointed out by Bernard Brinkhus * python/tests/exslt.py: trouble with mem debug in that specific test... Daniel
		
			
				
	
	
		
			59 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/python -u
 | 
						|
import sys
 | 
						|
import libxml2
 | 
						|
import libxslt
 | 
						|
 | 
						|
# Memory debug specific
 | 
						|
#libxml2.debugMemory(1)
 | 
						|
 | 
						|
 | 
						|
styledoc = libxml2.parseDoc(
 | 
						|
"""<?xml version="1.0"?>
 | 
						|
<xsl:stylesheet version="1.0"
 | 
						|
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 | 
						|
    xmlns:str="http://exslt.org/strings"
 | 
						|
    exclude-result-prefixes="str">
 | 
						|
 | 
						|
<xsl:template match="/">
 | 
						|
<out>;
 | 
						|
  str:tokenize('2001-06-03T11:40:23', '-T:')
 | 
						|
  <xsl:copy-of select="str:tokenize('2001-06-03T11:40:23', '-T:')"/>;
 | 
						|
 | 
						|
  str:tokenize('date math str')
 | 
						|
  <xsl:copy-of select="str:tokenize('date math str')"/>;
 | 
						|
</out>
 | 
						|
</xsl:template>
 | 
						|
 | 
						|
</xsl:stylesheet>
 | 
						|
""")
 | 
						|
style = libxslt.parseStylesheetDoc(styledoc)
 | 
						|
doc = libxml2.parseDoc("<doc/>")
 | 
						|
result = style.applyStylesheet(doc, None)
 | 
						|
stringval = style.saveResultToString(result)
 | 
						|
style.freeStylesheet()
 | 
						|
doc.freeDoc()
 | 
						|
result.freeDoc()
 | 
						|
 | 
						|
expect="""<?xml version="1.0"?>
 | 
						|
<out>;
 | 
						|
  str:tokenize('2001-06-03T11:40:23', '-T:')
 | 
						|
  <token>2001</token><token>06</token><token>03</token><token>11</token><token>40</token><token>23</token>;
 | 
						|
 | 
						|
  str:tokenize('date math str')
 | 
						|
  <token>date</token><token>math</token><token>str</token>;
 | 
						|
</out>
 | 
						|
"""
 | 
						|
 | 
						|
if stringval != expect:
 | 
						|
  print "Exslt processing failed"
 | 
						|
  sys.exit(255)
 | 
						|
    
 | 
						|
# Memory debug specific
 | 
						|
#libxslt.cleanup()
 | 
						|
#if libxml2.debugMemory(1) == 0:
 | 
						|
#    print "OK"
 | 
						|
#else:
 | 
						|
#    print "Memory leak %d bytes" % (libxml2.debugMemory(1))
 | 
						|
#    libxml2.dumpMemory()
 | 
						|
print "OK"
 |