Hi,

The patch below make G-Wrap generate code that uses `static const' data
rather than stack-allocated data when possible.

Thanks,
Ludovic.

# Bazaar revision bundle v0.9
#
# message:
#   Slight C code generation improvements.
#   
#   * guile/g-wrap/guile.scm (function-wrapper-cg): Use `static const' storage
#     for `typespecs'.  Don't use `scm_values ()' when all out parameters are
#     invisible.
#   
#   
# committer: Ludovic Courtes <[EMAIL PROTECTED]>
# date: Mon 2007-06-25 00:57:43.970999956 +0200

=== modified file guile/g-wrap/guile.scm
--- guile/g-wrap/guile.scm
+++ guile/g-wrap/guile.scm
@@ -321,13 +321,13 @@
      (if (zero? nargs)
 	 '()
 	 (list
-	  "  GWTypeSpec *typespec = NULL;\n"
-	  "  GWTypeSpec typespecs[] = { " (string-join
-					   (map
-					    (lambda (param)
-					      (typespec-cg (type param) (typespec param)))
-					    scm-params)
-					   ", ") " };\n"))
+	  "  const GWTypeSpec *typespec = NULL;\n"
+	  "  static const GWTypeSpec typespecs[] = { "
+          (string-join
+           (map (lambda (param)
+                  (typespec-cg (type param) (typespec param)))
+                scm-params)
+           ", ") " };\n"))
 
      (if (needs-result-var? return-type)
          (let ((c-value (default-c-value-for-type return-type)))
@@ -487,7 +487,7 @@
       "    gw_handle_wrapper_error(NULL, &gw__error,\n"
       "                             " fn-c-string ",\n"
       "                             gw__arg_pos);\n"
-      (if (null? out-params)
+      (if (null? (filter visible? out-params))
 	  "  return gw__scm_result;\n"
 	  (list
 	   "  return scm_values (scm_list_n ("

=== modified directory  // last-changed:[EMAIL PROTECTED]
... d9d
# revision id: [EMAIL PROTECTED]
# sha1: db8d20bfe28bfc0e8781865673dd33d24cb85e34
# inventory sha1: 0308da0f04e6fdf93a51912449a4122611ed3782
# parent ids:
#   [EMAIL PROTECTED]
# base id: [EMAIL PROTECTED]
# properties:
#   branch-nick: g-wrap

_______________________________________________
g-wrap-dev mailing list
g-wrap-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/g-wrap-dev

Reply via email to