SHA256
1
0
forked from pool/expat
expat/expat-alloc-size.patch
Ismail Dönmez 89d01b6ea1 Accepting request 383019 from home:elvigia:branches:devel:libraries:c_c++
- After simplification of expat-visibility.patch, it became
  uneffective as no symbols are getting hidden. add
  -fvisibility=hidden to CFLAGS again.
- expat-alloc-size.patch: fix braino, realloc()-like functions
  should not take __attribute__(malloc)

OBS-URL: https://build.opensuse.org/request/show/383019
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/expat?expand=0&rev=45
2016-04-01 16:55:19 +00:00

40 lines
1.2 KiB
Diff

Index: expat-2.1.1/lib/expat.h
===================================================================
--- expat-2.1.1.orig/lib/expat.h
+++ expat-2.1.1/lib/expat.h
@@ -973,9 +973,12 @@ XML_FreeContentModel(XML_Parser parser,
/* Exposing the memory handling functions used in Expat */
XMLPARSEAPI(void *)
+XML_ATTR_MALLOC
+XML_ATTR_ALLOC_SIZE(2)
XML_MemMalloc(XML_Parser parser, size_t size);
XMLPARSEAPI(void *)
+XML_ATTR_ALLOC_SIZE(3)
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
XMLPARSEAPI(void)
Index: expat-2.1.1/lib/expat_external.h
===================================================================
--- expat-2.1.1.orig/lib/expat_external.h
+++ expat-2.1.1/lib/expat_external.h
@@ -70,6 +70,17 @@
#define XMLIMPORT __attribute__ ((visibility ("default")))
#endif
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
+#define XML_ATTR_MALLOC __attribute__((__malloc__))
+#else
+#define XML_ATTR_MALLOC
+#endif
+
+#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
+#else
+#define XML_ATTR_ALLOC_SIZE(x)
+#endif
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL