Fix sample closure code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
diff --git a/ChangeLog b/ChangeLog
index ad13df5..d6bbd59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-11-15 Andrew Haley <aph@redhat.com>
+ * doc/libffi.texi (Closure Example): Fix the sample code.
+ * doc/libffi.info, doc/stamp-vti, doc/version.texi: Rebuilt.
+
+2013-11-15 Andrew Haley <aph@redhat.com>
+
* testsuite/libffi.call/va_struct1.c (main): Fix broken test.
* testsuite/libffi.call/cls_uint_va.c (cls_ret_T_fn): Likewise
* testsuite/libffi.call/cls_struct_va1.c (test_fn): Likewise.
diff --git a/doc/libffi.info b/doc/libffi.info
index 4d42f5b..de69aaf 100644
--- a/doc/libffi.info
+++ b/doc/libffi.info
@@ -478,19 +478,21 @@ A trivial example that creates a new 'puts' by binding 'fputs' with
#include <ffi.h>
/* Acts like puts with the file given at time of enclosure. */
- void puts_binding(ffi_cif *cif, ffi_arg *ret, void* args[],
- FILE *stream)
+ void puts_binding(ffi_cif *cif, void *ret, void* args[],
+ void *stream)
{
- *ret = fputs(*(char **)args[0], stream);
+ *(ffi_arg *)ret = fputs(*(char **)args[0], (FILE *)stream);
}
+ typedef int (*puts_t)(char *);
+
int main()
{
ffi_cif cif;
ffi_type *args[1];
ffi_closure *closure;
- int (*bound_puts)(char *);
+ void *bound_puts;
int rc;
/* Allocate closure and bound_puts */
@@ -509,7 +511,7 @@ A trivial example that creates a new 'puts' by binding 'fputs' with
if (ffi_prep_closure_loc(closure, &cif, puts_binding,
stdout, bound_puts) == FFI_OK)
{
- rc = bound_puts("Hello World!");
+ rc = ((puts_t)bound_puts)("Hello World!");
/* rc now holds the result of the call to fputs */
}
}
@@ -610,7 +612,7 @@ Node: Type Example11207
Node: Multiple ABIs12473
Node: The Closure API12844
Node: Closure Example15788
-Node: Missing Features17342
-Node: Index17795
+Node: Missing Features17396
+Node: Index17849
End Tag Table
diff --git a/doc/libffi.texi b/doc/libffi.texi
index d13c5c0..57dae0b 100644
--- a/doc/libffi.texi
+++ b/doc/libffi.texi
@@ -541,21 +541,23 @@ A trivial example that creates a new @code{puts} by binding
#include <ffi.h>
/* Acts like puts with the file given at time of enclosure. */
-void puts_binding(ffi_cif *cif, ffi_arg *ret, void* args[],
- FILE *stream)
+void puts_binding(ffi_cif *cif, void *ret, void* args[],
+ void *stream)
@{
- *ret = fputs(*(char **)args[0], stream);
+ *(ffi_arg *)ret = fputs(*(char **)args[0], (FILE *)stream);
@}
+typedef int (*puts_t)(char *);
+
int main()
@{
ffi_cif cif;
ffi_type *args[1];
ffi_closure *closure;
- int (*bound_puts)(char *);
+ void *bound_puts;
int rc;
-
+
/* Allocate closure and bound_puts */
closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts);
@@ -569,10 +571,10 @@ int main()
&ffi_type_sint, args) == FFI_OK)
@{
/* Initialize the closure, setting stream to stdout */
- if (ffi_prep_closure_loc(closure, &cif, puts_binding,
+ if (ffi_prep_closure_loc(closure, &cif, puts_binding,
stdout, bound_puts) == FFI_OK)
@{
- rc = bound_puts("Hello World!");
+ rc = ((puts_t)bound_puts)("Hello World!");
/* rc now holds the result of the call to fputs */
@}
@}
diff --git a/doc/stamp-vti b/doc/stamp-vti
index 3c7f7b2..9a06fab 100644
--- a/doc/stamp-vti
+++ b/doc/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 13 November 2013
+@set UPDATED 16 November 2013
@set UPDATED-MONTH November 2013
@set EDITION 3.0.14-rc0
@set VERSION 3.0.14-rc0
diff --git a/doc/version.texi b/doc/version.texi
index 3c7f7b2..9a06fab 100644
--- a/doc/version.texi
+++ b/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 13 November 2013
+@set UPDATED 16 November 2013
@set UPDATED-MONTH November 2013
@set EDITION 3.0.14-rc0
@set VERSION 3.0.14-rc0