projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
update readme
[m6w6/ext-psi]
/
src
/
types
/
cpp_macro_decl.c
diff --git
a/src/types/cpp_macro_decl.c
b/src/types/cpp_macro_decl.c
index 6d3747e58dbaa4bed08fb0fc3ae4d7c4c0fd82e0..40e6c97efb7afb73389d325a5c318fdef26d7eb5 100644
(file)
--- a/
src/types/cpp_macro_decl.c
+++ b/
src/types/cpp_macro_decl.c
@@
-23,7
+23,11
@@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
-#include "php_psi_stdinc.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# include "php_config.h"
+#endif
#include "cpp.h"
#include "data.h"
#include "cpp.h"
#include "data.h"
@@
-31,7
+35,7
@@
struct psi_cpp_macro_decl *psi_cpp_macro_decl_init(struct psi_plist *sig,
struct psi_plist *tokens, struct psi_num_exp *exp)
{
struct psi_cpp_macro_decl *psi_cpp_macro_decl_init(struct psi_plist *sig,
struct psi_plist *tokens, struct psi_num_exp *exp)
{
- struct psi_cpp_macro_decl *macro =
calloc(1, sizeof(*macro)
);
+ struct psi_cpp_macro_decl *macro =
pecalloc(1, sizeof(*macro), 1
);
macro->exp = exp;
macro->sig = sig;
macro->tokens = tokens;
macro->exp = exp;
macro->sig = sig;
macro->tokens = tokens;
@@
-44,9
+48,7
@@
void psi_cpp_macro_decl_free(struct psi_cpp_macro_decl **macro_ptr)
struct psi_cpp_macro_decl *macro = *macro_ptr;
*macro_ptr = NULL;
struct psi_cpp_macro_decl *macro = *macro_ptr;
*macro_ptr = NULL;
- if (macro->token) {
- free(macro->token);
- }
+ psi_token_free(¯o->token);
if (macro->exp) {
psi_num_exp_free(¯o->exp);
}
if (macro->exp) {
psi_num_exp_free(¯o->exp);
}
@@
-60,40
+62,41
@@
void psi_cpp_macro_decl_free(struct psi_cpp_macro_decl **macro_ptr)
}
}
}
}
-void psi_cpp_macro_decl_dump(
int fd
, struct psi_cpp_macro_decl *macro)
+void psi_cpp_macro_decl_dump(
struct psi_dump *dump
, struct psi_cpp_macro_decl *macro)
{
{
-
dprintf(fd, "%s", macro->token->text
);
+
PSI_DUMP(dump, "%s", macro->token->text->val
);
if (macro->sig) {
size_t i = 0;
struct psi_token *tok;
if (macro->sig) {
size_t i = 0;
struct psi_token *tok;
-
dprintf(fd
, "(");
+
PSI_DUMP(dump
, "(");
while (psi_plist_get(macro->sig, i++, &tok)) {
while (psi_plist_get(macro->sig, i++, &tok)) {
-
dprintf(fd, "%s%s", i>1?",":"", tok->text
);
+
PSI_DUMP(dump, "%s%s", i>1?",":"", tok->text->val
);
}
}
-
dprintf(fd
, ")");
+
PSI_DUMP(dump
, ")");
}
if (macro->exp) {
}
if (macro->exp) {
- dprintf(fd, " ");
- psi_num_exp_dump(fd, macro->exp);
- if (!macro->tokens) abort();
- } else
- if (macro->tokens) {
+ PSI_DUMP(dump, " ");
+ psi_num_exp_dump(dump, macro->exp);
+
+ assert(macro->tokens);
+
+ } else if (macro->tokens) {
size_t i = 0;
struct psi_token *tok;
while (psi_plist_get(macro->tokens, i++, &tok)) {
switch (tok->type) {
case PSI_T_QUOTED_STRING:
size_t i = 0;
struct psi_token *tok;
while (psi_plist_get(macro->tokens, i++, &tok)) {
switch (tok->type) {
case PSI_T_QUOTED_STRING:
-
dprintf(fd, " \"%s\"", tok->text
);
+
PSI_DUMP(dump, " \"%s\"", tok->text->val
);
break;
case PSI_T_QUOTED_CHAR:
break;
case PSI_T_QUOTED_CHAR:
-
dprintf(fd, " '%s'", tok->text
);
+
PSI_DUMP(dump, " '%s'", tok->text->val
);
break;
default:
break;
default:
-
dprintf(fd, " %s", tok->text
);
+
PSI_DUMP(dump, " %s", tok->text->val
);
}
}
}
}
}
}
@@
-113,7
+116,7
@@
static inline bool cmp_token_list(struct psi_plist *l1, struct psi_plist *l2)
psi_plist_get(l1, i, &t1);
psi_plist_get(l2, i, &t2);
psi_plist_get(l1, i, &t1);
psi_plist_get(l2, i, &t2);
- if (
strcmp
(t1->text, t2->text)) {
+ if (
!zend_string_equals
(t1->text, t2->text)) {
return false;
}
}
return false;
}
}