[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Use `static const' where possible
From: |
Ludovic Courtès |
Subject: |
[PATCH] Use `static const' where possible |
Date: |
Thu, 28 Jun 2007 01:49:57 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
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 <address@hidden>
# 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:address@hidden
... d9d
# revision id: address@hidden
# sha1: db8d20bfe28bfc0e8781865673dd33d24cb85e34
# inventory sha1: 0308da0f04e6fdf93a51912449a4122611ed3782
# parent ids:
# address@hidden
# base id: address@hidden
# properties:
# branch-nick: g-wrap
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Use `static const' where possible,
Ludovic Courtès <=