Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed problem in setReferencePrefix().

  • Loading branch information...
commit eefd56dacdc9de9ffaf8e36f0e78476e5e19289a 1 parent b79182f
Gustavo Lopes authored
5 markdowndoc_class.c
@@ -132,6 +132,10 @@ static void free_object_storage(void *object TSRMLS_DC)
132 132 mkd_cleanup(dobj->markdoc);
133 133 dobj->markdoc = NULL;
134 134 }
  135 + if (dobj->ref_prefix != NULL) {
  136 + efree(dobj->ref_prefix);
  137 + dobj->ref_prefix = NULL;
  138 + }
135 139
136 140 markdowndoc_free_callback(&dobj->url_fci, &dobj->url_fcc);
137 141 markdowndoc_free_callback(&dobj->attr_fci, &dobj->attr_fcc);
@@ -160,6 +164,7 @@ static zend_object_value ce_create_object(zend_class_entry *class_type TSRMLS_DC
160 164 dobj->url_fcc = NULL;
161 165 dobj->attr_fci = NULL;
162 166 dobj->attr_fcc = NULL;
  167 + dobj->ref_prefix = NULL;
163 168
164 169 zov.handle = zend_objects_store_put(dobj,
165 170 (zend_objects_store_dtor_t) zend_objects_destroy_object,
1  markdowndoc_class.h
@@ -37,6 +37,7 @@ typedef struct discount_object {
37 37 zend_fcall_info_cache *url_fcc;
38 38 zend_fcall_info *attr_fci;
39 39 zend_fcall_info_cache *attr_fcc;
  40 + char *ref_prefix;
40 41 } discount_object;
41 42
42 43 extern zend_class_entry *markdowndoc_ce;
6 markdowndoc_meth_misc.c
@@ -201,7 +201,11 @@ PHP_METHOD(markdowndoc, setReferencePrefix)
201 201 RETURN_FALSE;
202 202 }
203 203
204   - mkd_ref_prefix(dobj->markdoc, prefix);
  204 + if (dobj->ref_prefix != NULL) {
  205 + efree(dobj->ref_prefix);
  206 + }
  207 + dobj->ref_prefix = estrndup(prefix, prefix_len);
  208 + mkd_ref_prefix(dobj->markdoc, dobj->ref_prefix);
205 209
206 210 RETURN_TRUE;
207 211 }

0 comments on commit eefd56d

Please sign in to comment.
Something went wrong with that request. Please try again.