Gitweb links:
...log
http://git.netsurf-browser.org/nsgenbind.git/shortlog/8912c51fe275a7d8deb...
...commit
http://git.netsurf-browser.org/nsgenbind.git/commit/8912c51fe275a7d8debe1...
...tree
http://git.netsurf-browser.org/nsgenbind.git/tree/8912c51fe275a7d8debe12f...
The branch, master has been updated
via 8912c51fe275a7d8debe12f84f7e86ce4a240266 (commit)
from b0f64cff2c94d1a208528e2ed91c15ab037dbbb1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/nsgenbind.git/commit/?id=8912c51fe275a7d8d...
commit 8912c51fe275a7d8debe12f84f7e86ce4a240266
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
only publicly export initialisors and finalisors if necessary
diff --git a/src/duk-libdom-dictionary.c b/src/duk-libdom-dictionary.c
index 275855e..6aae0ca 100644
--- a/src/duk-libdom-dictionary.c
+++ b/src/duk-libdom-dictionary.c
@@ -367,6 +367,9 @@ output_dictionary_init_declaration(FILE* outf,
{
struct genbind_node *param_node;
+ if (dictionarye->refcount == 0) {
+ fprintf(outf, "static ");
+ }
fprintf(outf,
"void %s_%s___init(duk_context *ctx, %s_private_t *priv",
DLPFX, dictionarye->class_name, dictionarye->class_name);
@@ -446,6 +449,9 @@ output_dictionary_fini(FILE* outf,
GENBIND_METHOD_TYPE_FINI);
/* finaliser definition */
+ if (dictionarye->refcount == 0) {
+ fprintf(outf, "static ");
+ }
fprintf(outf,
"void %s_%s___fini(duk_context *ctx, %s_private_t *priv)\n",
DLPFX, dictionarye->class_name, dictionarye->class_name);
diff --git a/src/duk-libdom-interface.c b/src/duk-libdom-interface.c
index 7501bea..3ac7d83 100644
--- a/src/duk-libdom-interface.c
+++ b/src/duk-libdom-interface.c
@@ -432,6 +432,9 @@ output_interface_init_declaration(FILE* outf,
{
struct genbind_node *param_node;
+ if (interfacee->refcount == 0) {
+ fprintf(outf, "static ");
+ }
fprintf(outf,
"void %s_%s___init(duk_context *ctx, %s_private_t *priv",
DLPFX, interfacee->class_name, interfacee->class_name);
@@ -510,7 +513,11 @@ output_interface_fini(FILE* outf,
NULL,
GENBIND_METHOD_TYPE_FINI);
+
/* finaliser definition */
+ if (interfacee->refcount == 0) {
+ fprintf(outf, "static ");
+ }
fprintf(outf,
"void %s_%s___fini(duk_context *ctx, %s_private_t *priv)\n",
DLPFX, interfacee->class_name, interfacee->class_name);
diff --git a/src/duk-libdom.c b/src/duk-libdom.c
index 45e7e79..02b41b3 100644
--- a/src/duk-libdom.c
+++ b/src/duk-libdom.c
@@ -331,26 +331,27 @@ output_prototype_header(struct ir *ir)
fprintf(protof, "duk_ret_t %s_%s___proto(duk_context
*ctx);\n",
DLPFX, interfacee->class_name);
- /** \todo if the interface has no references (no other
- * interface inherits from it) there is no reason to export
- * the initalisor/finaliser as no other class
- * constructor/destructor should call them. Additionally the
- * init/fini definition should be made static.
+ /* if the interface has no references (no other interface
+ * inherits from it) there is no reason to export the
+ * initalisor/finaliser as no other class
+ * constructor/destructor should call them.
*/
-
- /* finaliser declaration */
- fprintf(protof,
- "void %s_%s___fini(duk_context *ctx, %s_private_t
*priv);\n",
- DLPFX, interfacee->class_name, interfacee->class_name);
-
- /* find the initialisor method on the class (if any) */
- init_node = genbind_node_find_method(interfacee->class,
- NULL,
- GENBIND_METHOD_TYPE_INIT);
-
- /* initialisor definition */
- output_interface_init_declaration(protof, interfacee, init_node);
- fprintf(protof, ";\n\n");
+ if (interfacee->refcount > 0) {
+ /* finaliser declaration */
+ fprintf(protof,
+ "void %s_%s___fini(duk_context *ctx, %s_private_t
*priv);\n",
+ DLPFX, interfacee->class_name,
interfacee->class_name);
+
+ /* find the initialisor method on the class (if any) */
+ init_node = genbind_node_find_method(interfacee->class,
+ NULL,
+ GENBIND_METHOD_TYPE_INIT);
+
+ /* initialisor definition */
+ output_interface_init_declaration(protof, interfacee,
init_node);
+ fprintf(protof, ";\n\n");
+ }
+ fprintf(protof, "\n");
}
close_header(ir, protof, "prototype");
-----------------------------------------------------------------------
Summary of changes:
src/duk-libdom-dictionary.c | 6 ++++++
src/duk-libdom-interface.c | 7 +++++++
src/duk-libdom.c | 39 ++++++++++++++++++++-------------------
3 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/src/duk-libdom-dictionary.c b/src/duk-libdom-dictionary.c
index 275855e..6aae0ca 100644
--- a/src/duk-libdom-dictionary.c
+++ b/src/duk-libdom-dictionary.c
@@ -367,6 +367,9 @@ output_dictionary_init_declaration(FILE* outf,
{
struct genbind_node *param_node;
+ if (dictionarye->refcount == 0) {
+ fprintf(outf, "static ");
+ }
fprintf(outf,
"void %s_%s___init(duk_context *ctx, %s_private_t *priv",
DLPFX, dictionarye->class_name, dictionarye->class_name);
@@ -446,6 +449,9 @@ output_dictionary_fini(FILE* outf,
GENBIND_METHOD_TYPE_FINI);
/* finaliser definition */
+ if (dictionarye->refcount == 0) {
+ fprintf(outf, "static ");
+ }
fprintf(outf,
"void %s_%s___fini(duk_context *ctx, %s_private_t *priv)\n",
DLPFX, dictionarye->class_name, dictionarye->class_name);
diff --git a/src/duk-libdom-interface.c b/src/duk-libdom-interface.c
index 7501bea..3ac7d83 100644
--- a/src/duk-libdom-interface.c
+++ b/src/duk-libdom-interface.c
@@ -432,6 +432,9 @@ output_interface_init_declaration(FILE* outf,
{
struct genbind_node *param_node;
+ if (interfacee->refcount == 0) {
+ fprintf(outf, "static ");
+ }
fprintf(outf,
"void %s_%s___init(duk_context *ctx, %s_private_t *priv",
DLPFX, interfacee->class_name, interfacee->class_name);
@@ -510,7 +513,11 @@ output_interface_fini(FILE* outf,
NULL,
GENBIND_METHOD_TYPE_FINI);
+
/* finaliser definition */
+ if (interfacee->refcount == 0) {
+ fprintf(outf, "static ");
+ }
fprintf(outf,
"void %s_%s___fini(duk_context *ctx, %s_private_t *priv)\n",
DLPFX, interfacee->class_name, interfacee->class_name);
diff --git a/src/duk-libdom.c b/src/duk-libdom.c
index 45e7e79..02b41b3 100644
--- a/src/duk-libdom.c
+++ b/src/duk-libdom.c
@@ -331,26 +331,27 @@ output_prototype_header(struct ir *ir)
fprintf(protof, "duk_ret_t %s_%s___proto(duk_context
*ctx);\n",
DLPFX, interfacee->class_name);
- /** \todo if the interface has no references (no other
- * interface inherits from it) there is no reason to export
- * the initalisor/finaliser as no other class
- * constructor/destructor should call them. Additionally the
- * init/fini definition should be made static.
+ /* if the interface has no references (no other interface
+ * inherits from it) there is no reason to export the
+ * initalisor/finaliser as no other class
+ * constructor/destructor should call them.
*/
-
- /* finaliser declaration */
- fprintf(protof,
- "void %s_%s___fini(duk_context *ctx, %s_private_t
*priv);\n",
- DLPFX, interfacee->class_name, interfacee->class_name);
-
- /* find the initialisor method on the class (if any) */
- init_node = genbind_node_find_method(interfacee->class,
- NULL,
- GENBIND_METHOD_TYPE_INIT);
-
- /* initialisor definition */
- output_interface_init_declaration(protof, interfacee, init_node);
- fprintf(protof, ";\n\n");
+ if (interfacee->refcount > 0) {
+ /* finaliser declaration */
+ fprintf(protof,
+ "void %s_%s___fini(duk_context *ctx, %s_private_t
*priv);\n",
+ DLPFX, interfacee->class_name,
interfacee->class_name);
+
+ /* find the initialisor method on the class (if any) */
+ init_node = genbind_node_find_method(interfacee->class,
+ NULL,
+ GENBIND_METHOD_TYPE_INIT);
+
+ /* initialisor definition */
+ output_interface_init_declaration(protof, interfacee,
init_node);
+ fprintf(protof, ";\n\n");
+ }
+ fprintf(protof, "\n");
}
close_header(ir, protof, "prototype");
--
NetSurf Generator for JavaScript bindings