projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
cache cpp defaults
[m6w6/ext-psi]
/
src
/
parser_proc_grammar.y
diff --git
a/src/parser_proc_grammar.y
b/src/parser_proc_grammar.y
index 6e07b5fd9fafb1ec9f1d4e781926d829ecde441c..1b40555e3fa9e777039cf1010ab48c8c13d9b020 100644
(file)
--- a/
src/parser_proc_grammar.y
+++ b/
src/parser_proc_grammar.y
@@
-60,8
+60,8
@@
static inline void psi_parser_proc_deanon_typedef(struct psi_decl_arg *def)
default:
return;
}
default:
return;
}
-
fre
e(def->type->name);
- def->type->name =
strdup
(def->var->name);
+
zend_string_releas
e(def->type->name);
+ def->type->name =
zend_string_copy
(def->var->name);
}
static inline void psi_parser_proc_add_typedef(struct psi_parser *P, struct psi_decl_arg *def)
{
}
static inline void psi_parser_proc_add_typedef(struct psi_parser *P, struct psi_decl_arg *def)
{
@@
-83,7
+83,7
@@
static inline void psi_parser_proc_add_const(struct psi_parser *P, struct psi_co
static inline void psi_parser_proc_add_decl(struct psi_parser *P, struct psi_decl *decl) {
assert(decl);
static inline void psi_parser_proc_add_decl(struct psi_parser *P, struct psi_decl *decl) {
assert(decl);
- if (psi_decl_is_blacklisted(decl->func->var->name)) {
+ if (psi_decl_is_blacklisted(decl->func->var->name
->val
)) {
psi_decl_free(&decl);
return;
}
psi_decl_free(&decl);
return;
}
@@
-456,7
+456,7
@@
block:
}
}
| lib {
}
}
| lib {
- char *libname = strdup($lib->text);
+ char *libname = strdup($lib->text
->val
);
P->file.libnames = psi_plist_add(P->file.libnames, &libname);
}
| constant {
P->file.libnames = psi_plist_add(P->file.libnames, &libname);
}
| constant {
@@
-470,7
+470,7
@@
block:
}
| ignored_decl {
if (P->flags & PSI_DEBUG) {
}
| ignored_decl {
if (P->flags & PSI_DEBUG) {
- P->error(PSI_DATA(P), $ignored_decl->func->token, PSI_NOTICE, "Ignored decl: %s", $ignored_decl->func->var->name);
+ P->error(PSI_DATA(P), $ignored_decl->func->token, PSI_NOTICE, "Ignored decl: %s", $ignored_decl->func->var->name
->val
);
}
psi_decl_free(&$ignored_decl);
}
}
psi_decl_free(&$ignored_decl);
}
@@
-519,7
+519,7
@@
cpp_exp[exp]:
while (psi_plist_get($tokens, index++, &next)) {
struct psi_token *old = msg;
msg = psi_token_cat(" ", 2, msg, next);
while (psi_plist_get($tokens, index++, &next)) {
struct psi_token *old = msg;
msg = psi_token_cat(" ", 2, msg, next);
-
free(
old);
+
psi_token_free(&
old);
}
}
psi_plist_free($tokens);
}
}
psi_plist_free($tokens);
@@
-947,7
+947,7
@@
decl_type_simple[type]:
}
;
}
;
-decl_real_type[type]:
+decl_real_type[type]:
/* allocated, so free, if set */
FLOAT[type_] {
$type = psi_token_copy($type_);
}
FLOAT[type_] {
$type = psi_token_copy($type_);
}
@@
-964,7
+964,7
@@
int_signed[i]:
| UNSIGNED
;
| UNSIGNED
;
-int_width[i]:
+int_width[i]:
/* allocated, so free, if set */
SHORT {
$i = psi_token_copy($SHORT);
}
SHORT {
$i = psi_token_copy($SHORT);
}
@@
-976,7
+976,7
@@
int_width[i]:
}
;
}
;
-decl_int_type[type]:
+decl_int_type[type]:
/* allocated, so free, if set */
CHAR {
$type = psi_token_copy($CHAR);
}
CHAR {
$type = psi_token_copy($CHAR);
}
@@
-986,7
+986,7
@@
decl_int_type[type]:
| int_signed int_signed_types {
if ($2) {
$type = psi_token_cat(" ", 2, $1, $2);
| int_signed int_signed_types {
if ($2) {
$type = psi_token_cat(" ", 2, $1, $2);
-
free(
$2);
+
psi_token_free(&
$2);
} else {
$type = psi_token_copy($1);
}
} else {
$type = psi_token_copy($1);
}
@@
-994,15
+994,15
@@
decl_int_type[type]:
| int_width int_width_types {
if ($2) {
$type = psi_token_cat(" ", 2, $1, $2);
| int_width int_width_types {
if ($2) {
$type = psi_token_cat(" ", 2, $1, $2);
-
free(
$1);
-
free(
$2);
+
psi_token_free(&
$1);
+
psi_token_free(&
$2);
} else {
$type = $1;
}
}
;
} else {
$type = $1;
}
}
;
-int_signed_types[type]:
+int_signed_types[type]:
/* allocated, so free, if set */
%empty {
$type = NULL;
}
%empty {
$type = NULL;
}
@@
-1046,7
+1046,7
@@
signed_long_types[type]:
| LONG INT
;
| LONG INT
;
-int_width_types[type]:
+int_width_types[type]:
/* allocated, so free, if set */
%empty {
$type = NULL;
}
%empty {
$type = NULL;
}
@@
-1056,7
+1056,7
@@
int_width_types[type]:
| int_signed int_signed_types {
if ($2) {
$type = psi_token_cat(" ", 2, $1, $2);
| int_signed int_signed_types {
if ($2) {
$type = psi_token_cat(" ", 2, $1, $2);
-
free(
$2);
+
psi_token_free(&
$2);
} else {
$type = psi_token_copy($1);
}
} else {
$type = psi_token_copy($1);
}
@@
-1067,15
+1067,15
@@
decl_stmt:
decl decl_asm EOS {
$decl_stmt = $decl;
if ($decl_asm) {
decl decl_asm EOS {
$decl_stmt = $decl;
if ($decl_asm) {
- $decl->redir =
strdup
($decl_asm->text);
-
free(
$decl_asm);
+ $decl->redir =
zend_string_copy
($decl_asm->text);
+
psi_token_free(&
$decl_asm);
}
}
| CPP_EXTENSION decl decl_asm EOS {
$decl_stmt = $decl;
if ($decl_asm) {
}
}
| CPP_EXTENSION decl decl_asm EOS {
$decl_stmt = $decl;
if ($decl_asm) {
- $decl->redir =
strdup
($decl_asm->text);
-
free(
$decl_asm);
+ $decl->redir =
zend_string_copy
($decl_asm->text);
+
psi_token_free(&
$decl_asm);
}
}
;
}
}
;
@@
-1095,7
+1095,7
@@
quoted_strings[strings]:
}
| quoted_strings[strings_] QUOTED_STRING {
$strings = psi_token_cat("", 2, $strings_, $QUOTED_STRING);
}
| quoted_strings[strings_] QUOTED_STRING {
$strings = psi_token_cat("", 2, $strings_, $QUOTED_STRING);
-
free(
$strings_);
+
psi_token_free(&
$strings_);
}
;
}
;
@@
-1108,7
+1108,7
@@
decl_extvar_stmt[list]:
struct psi_decl_var *var;
while (psi_plist_get($vars, i++, &var)) {
struct psi_decl_var *var;
while (psi_plist_get($vars, i++, &var)) {
- if (psi_decl_extvar_is_blacklisted(var->name)) {
+ if (psi_decl_extvar_is_blacklisted(var->name
->val
)) {
psi_decl_var_free(&var);
} else {
struct psi_decl_extvar *evar = psi_decl_extvar_init(
psi_decl_var_free(&var);
} else {
struct psi_decl_extvar *evar = psi_decl_extvar_init(
@@
-1119,7
+1119,7
@@
decl_extvar_stmt[list]:
free($vars);
}
free($vars);
}
- if (psi_decl_extvar_is_blacklisted($decl_arg->var->name)) {
+ if (psi_decl_extvar_is_blacklisted($decl_arg->var->name
->val
)) {
psi_decl_arg_free(&$decl_arg);
} else {
struct psi_decl_extvar *evar = psi_decl_extvar_init($decl_arg);
psi_decl_arg_free(&$decl_arg);
} else {
struct psi_decl_extvar *evar = psi_decl_extvar_init($decl_arg);
@@
-1422,7
+1422,7
@@
decl_anon_arg[arg]:
char digest[17];
struct psi_token *name;
char digest[17];
struct psi_token *name;
- psi_token_hash($decl->func
->token, digest);
+ psi_token_hash($decl->func->token, digest);
name = psi_token_append("@", psi_token_copy($decl->func->token), 2, "funct", digest);
$arg = psi_decl_arg_init(
name = psi_token_append("@", psi_token_copy($decl->func->token), 2, "funct", digest);
$arg = psi_decl_arg_init(
@@
-1721,7
+1721,7
@@
sizeof_body_notypes[sizeof]:
$sizeof = psi_number_init(PSI_T_INT8, &sizeof_a, 0);
}
| QUOTED_STRING {
$sizeof = psi_number_init(PSI_T_INT8, &sizeof_a, 0);
}
| QUOTED_STRING {
- uint64_t len = $QUOTED_STRING->
size
+ 1;
+ uint64_t len = $QUOTED_STRING->
text->len
+ 1;
$sizeof = psi_number_init(PSI_T_UINT64, &len, 0);
}
;
$sizeof = psi_number_init(PSI_T_UINT64, &len, 0);
}
;
@@
-1785,13
+1785,13
@@
decl_layout[l]:
$l = NULL;
}
| COLON NUMBER[width] {
$l = NULL;
}
| COLON NUMBER[width] {
- $l = psi_layout_init(0, 0, psi_layout_init(0, atol($width->text), NULL));
+ $l = psi_layout_init(0, 0, psi_layout_init(0, atol($width->text
->val
), NULL));
}
| COLON COLON LPAREN NUMBER[align] COMMA NUMBER[size] RPAREN {
}
| COLON COLON LPAREN NUMBER[align] COMMA NUMBER[size] RPAREN {
- $l = psi_layout_init(atol($align->text
), atol($size->text
), NULL);
+ $l = psi_layout_init(atol($align->text
->val), atol($size->text->val
), NULL);
}
| COLON NUMBER[width] COLON COLON LPAREN NUMBER[align] COMMA NUMBER[size] RPAREN {
}
| COLON NUMBER[width] COLON COLON LPAREN NUMBER[align] COMMA NUMBER[size] RPAREN {
- $l = psi_layout_init(atol($align->text
), atol($size->text), psi_layout_init(0, atol($width->text
), NULL));
+ $l = psi_layout_init(atol($align->text
->val), atol($size->text->val), psi_layout_init(0, atol($width->text->val
), NULL));
}
;
}
;
@@
-1801,8
+1801,8
@@
align_and_size[as]:
$as.len = 0;
}
| COLON COLON LPAREN NUMBER[align] COMMA NUMBER[size] RPAREN {
$as.len = 0;
}
| COLON COLON LPAREN NUMBER[align] COMMA NUMBER[size] RPAREN {
- $as.pos = atol($align->text);
- $as.len = atol($size->text);
+ $as.pos = atol($align->text
->val
);
+ $as.len = atol($size->text
->val
);
}
;
}
;