Fix generated C code calling between().

This commit is contained in:
Adrien Guatto 2011-05-12 16:27:14 +02:00
parent a15276f053
commit 36d93a411d
2 changed files with 3 additions and 2 deletions

View file

@ -756,7 +756,8 @@ let cfile_list_of_oprog_ty_decls name oprog =
let (cty_defs, cty_decls) = List.split cdefs_and_cdecls in
let filename_types = name ^ "_types" in
let types_h = (filename_types ^ ".h",
Cheader (["stdbool"; "assert"], List.concat cty_decls)) in
Cheader (["stdbool"; "assert"; "pervasives"],
List.concat cty_decls)) in
let types_c = (filename_types ^ ".c", Csource (concat cty_defs)) in
filename_types, [types_h; types_c]

View file

@ -4,7 +4,7 @@
#define DECADES_PERVASIVES_H
/* between(i, n) returns idx between 0 and n-1. */
inline int between(int idx, int n)
static inline int between(int idx, int n)
{
int o = (idx >= n) ? n-1 : (idx < 0 ? 0 : idx);
return o;