diff --git a/mps/code/abq.c b/mps/code/abq.c index c6620be89da..b88914e3c17 100644 --- a/mps/code/abq.c +++ b/mps/code/abq.c @@ -1,7 +1,7 @@ /* abq.c: QUEUE IMPLEMENTATION * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * .purpose: A fixed-length FIFO queue. * @@ -294,14 +294,15 @@ static Index ABQNextIndex(ABQ abq, Index index) /* ABQElement -- return pointer to the index'th element in the queue vector. */ -static void *ABQElement(ABQ abq, Index index) { +static void *ABQElement(ABQ abq, Index index) +{ return PointerAdd(abq->queue, index * abq->elementSize); } /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/abqtest.c b/mps/code/abqtest.c index b9618b2ff60..59f2a64fcd4 100644 --- a/mps/code/abqtest.c +++ b/mps/code/abqtest.c @@ -1,7 +1,7 @@ /* abqtest.c: AVAILABLE BLOCK QUEUE TEST * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. */ #include "abq.h" @@ -149,7 +149,7 @@ static void step(void) } } -extern int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { mps_arena_t arena; int i; @@ -182,7 +182,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2014 Ravenbrook Limited . + * Copyright (c) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/arena.c b/mps/code/arena.c index 51460302a7a..20cd2457b8c 100644 --- a/mps/code/arena.c +++ b/mps/code/arena.c @@ -1,7 +1,7 @@ /* arena.c: ARENA ALLOCATION FEATURES * * $Id$ - * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * .sources: is the main design document. */ @@ -726,7 +726,8 @@ Res ControlDescribe(Arena arena, mps_lib_FILE *stream, Count depth) * if not already set. */ -void ArenaChunkInsert(Arena arena, Chunk chunk) { +void ArenaChunkInsert(Arena arena, Chunk chunk) +{ Bool inserted; Tree tree, updatedTree = NULL; @@ -1411,7 +1412,7 @@ Bool ArenaHasAddr(Arena arena, Addr addr) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2016 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/arg.c b/mps/code/arg.c index 82f936b92cb..8d129534a70 100644 --- a/mps/code/arg.c +++ b/mps/code/arg.c @@ -1,7 +1,7 @@ /* arg.c: ARGUMENT LISTS * * $Id$ - * Copyright (c) 2013-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2013-2018 Ravenbrook Limited. See end of file for license. * * .source: See . */ @@ -20,86 +20,102 @@ SRCID(arg, "$Id$"); * that don't have any meaningful checking they can do. */ -Bool ArgCheckCant(Arg arg) { +Bool ArgCheckCant(Arg arg) +{ UNUSED(arg); return TRUE; } -static Bool ArgCheckShouldnt(Arg arg) { +static Bool ArgCheckShouldnt(Arg arg) +{ UNUSED(arg); NOTREACHED; return FALSE; } -Bool ArgCheckFormat(Arg arg) { +Bool ArgCheckFormat(Arg arg) +{ CHECKD(Format, arg->val.format); return TRUE; } -Bool ArgCheckChain(Arg arg) { +Bool ArgCheckChain(Arg arg) +{ CHECKD(Chain, arg->val.chain); return TRUE; } -Bool ArgCheckSize(Arg arg) { +Bool ArgCheckSize(Arg arg) +{ UNUSED(arg); /* TODO: Add and call SizeCheck */ return TRUE; } -Bool ArgCheckAddr(Arg arg) { +Bool ArgCheckAddr(Arg arg) +{ UNUSED(arg); /* TODO: Add and call AddrCheck */ return TRUE; } -Bool ArgCheckPoolDebugOptions(Arg arg) { +Bool ArgCheckPoolDebugOptions(Arg arg) +{ CHECKD_NOSIG(PoolDebugOptions, (PoolDebugOptions)arg->val.pool_debug_options); return TRUE; } -Bool ArgCheckFun(Arg arg) { +Bool ArgCheckFun(Arg arg) +{ CHECKL(FUNCHECK(arg->val.addr_method)); /* FIXME: Potential pun here */ return TRUE; } -Bool ArgCheckAlign(Arg arg) { +Bool ArgCheckAlign(Arg arg) +{ CHECKL(AlignCheck(arg->val.align)); return TRUE; } -Bool ArgCheckBool(Arg arg) { +Bool ArgCheckBool(Arg arg) +{ CHECKL(BoolCheck(arg->val.b)); return TRUE; } -Bool ArgCheckCount(Arg arg) { +Bool ArgCheckCount(Arg arg) +{ UNUSED(arg); /* TODO: Add and call CountCheck */ return TRUE; } -Bool ArgCheckPointer(Arg arg) { +Bool ArgCheckPointer(Arg arg) +{ CHECKL(arg != NULL); return TRUE; } -Bool ArgCheckRankSet(Arg arg) { +Bool ArgCheckRankSet(Arg arg) +{ CHECKL(COMPATTYPE(RankSet, unsigned)); CHECKL(RankSetCheck(arg->val.u)); return TRUE; } -Bool ArgCheckRank(Arg arg) { +Bool ArgCheckRank(Arg arg) +{ CHECKL(RankCheck(arg->val.rank)); return TRUE; } -Bool ArgCheckdouble(Arg arg) { +Bool ArgCheckdouble(Arg arg) +{ /* Don't call isfinite() here because it's not in C89, and because infinity is a valid value for MPS_KEY_PAUSE_TIME. */ UNUSED(arg); return TRUE; } -Bool ArgCheckPool(Arg arg) { +Bool ArgCheckPool(Arg arg) +{ CHECKD(Pool, arg->val.pool); return TRUE; } @@ -146,7 +162,8 @@ Bool ArgListCheck(ArgList args) /* ArgPick -- try to pick an argument out of the argument list by keyword */ -Bool ArgPick(ArgStruct *argOut, ArgList args, Key key) { +Bool ArgPick(ArgStruct *argOut, ArgList args, Key key) +{ Index i; AVER(argOut != NULL); @@ -173,7 +190,8 @@ found: /* ArgRequire -- take a required argument out of the argument list by keyword */ -void ArgRequire(ArgStruct *argOut, ArgList args, Key key) { +void ArgRequire(ArgStruct *argOut, ArgList args, Key key) +{ Bool b = ArgPick(argOut, args, key); ASSERT(b, key->name); } @@ -192,7 +210,7 @@ void ArgTrivVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/bttest.c b/mps/code/bttest.c index 20bb4cab4e7..cc51b9cf63d 100644 --- a/mps/code/bttest.c +++ b/mps/code/bttest.c @@ -1,7 +1,7 @@ /* bttest.c: BIT TABLE TEST * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. */ @@ -311,7 +311,8 @@ static void obeyCommand(const char *command) } -static void showBT(void) { +static void showBT(void) +{ Index i; char c; if (bt == NULL) @@ -350,7 +351,7 @@ static void showBT(void) { #define testArenaSIZE (((size_t)64)<<20) -extern int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { bt = NULL; btSize = 0; @@ -376,7 +377,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/djbench.c b/mps/code/djbench.c index 0e4dbb3fc20..b94eb2dd171 100644 --- a/mps/code/djbench.c +++ b/mps/code/djbench.c @@ -1,7 +1,7 @@ /* djbench.c -- "DJ" Benchmark on ANSI C library * * $Id$ - * Copyright (c) 2013-2016 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2013-2018 Ravenbrook Limited. See end of file for license. * * This is an allocation stress benchmark test for manual variable pools * and also for stdlib malloc/free (for comparison). @@ -240,7 +240,8 @@ static struct { /* Command-line driver */ -int main(int argc, char *argv[]) { +int main(int argc, char *argv[]) +{ int ch; unsigned i; mps_bool_t seed_specified = FALSE; @@ -385,7 +386,7 @@ int main(int argc, char *argv[]) { /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2013-2016 Ravenbrook Limited . + * Copyright (c) 2013-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/event.c b/mps/code/event.c index e2825b5334f..b8f12383b0e 100644 --- a/mps/code/event.c +++ b/mps/code/event.c @@ -1,7 +1,7 @@ /* event.c: EVENT LOGGING * * $Id$ - * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * .sources: mps.design.event * @@ -509,7 +509,7 @@ Res EventWrite(Event event, mps_lib_FILE *stream) } -extern void EventDump(mps_lib_FILE *stream) +void EventDump(mps_lib_FILE *stream) { UNUSED(stream); } @@ -520,7 +520,7 @@ extern void EventDump(mps_lib_FILE *stream) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2016 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/fbmtest.c b/mps/code/fbmtest.c index 601cee57918..ddcdaca8075 100644 --- a/mps/code/fbmtest.c +++ b/mps/code/fbmtest.c @@ -1,7 +1,7 @@ /* fbmtest.c: FREE BLOCK MANAGEMENT TEST * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * The MPS contains two free block management modules: * @@ -77,7 +77,8 @@ static Index (indexOfAddr)(FBMState state, Addr a) } -static void describe(FBMState state) { +static void describe(FBMState state) +{ switch (state->type) { case FBMTypeCBS: die(CBSDescribe(state->the.cbs, mps_lib_get_stdout(), 0), @@ -506,7 +507,8 @@ static void find(FBMState state, Size size, Bool high, FindDelete findDelete) return; } -static void test(FBMState state, unsigned n) { +static void test(FBMState state, unsigned n) +{ Addr base, limit; unsigned i; Size size; @@ -549,7 +551,7 @@ static void test(FBMState state, unsigned n) { #define testArenaSIZE (((size_t)4)<<20) -extern int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { mps_arena_t mpsArena; Arena arena; /* the ANSI arena which we use to allocate the BT */ @@ -620,7 +622,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2014 Ravenbrook Limited . + * Copyright (c) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/fmtdy.c b/mps/code/fmtdy.c index 4457d637a59..2f88fd53d82 100644 --- a/mps/code/fmtdy.c +++ b/mps/code/fmtdy.c @@ -236,7 +236,7 @@ static mps_res_t dylan_scan_contig(mps_ss_t mps_ss, /* dylan_weak_dependent -- returns the linked object, if any. */ -extern mps_addr_t dylan_weak_dependent(mps_addr_t parent) +mps_addr_t dylan_weak_dependent(mps_addr_t parent) { mps_word_t *object; mps_word_t *wrapper; @@ -366,7 +366,7 @@ static mps_res_t dylan_scan_pat(mps_ss_t mps_ss, (_vt) << ((_es) - FMTDY_WORD_SHIFT)) -extern mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io) +mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io) { mps_addr_t *p; /* cursor in object */ mps_addr_t *q; /* cursor limit for loops */ @@ -549,7 +549,7 @@ static mps_addr_t dylan_class(mps_addr_t obj) return (mps_addr_t)first_word; } -extern mps_res_t dylan_scan1_weak(mps_ss_t mps_ss, mps_addr_t *object_io) +mps_res_t dylan_scan1_weak(mps_ss_t mps_ss, mps_addr_t *object_io) { mps_addr_t *assoc; mps_addr_t *base; diff --git a/mps/code/gcbench.c b/mps/code/gcbench.c index d9db1697d43..40612fbfab8 100644 --- a/mps/code/gcbench.c +++ b/mps/code/gcbench.c @@ -71,22 +71,26 @@ struct gcthread_s { typedef mps_word_t obj_t; -static obj_t mkvector(mps_ap_t ap, size_t n) { +static obj_t mkvector(mps_ap_t ap, size_t n) +{ mps_word_t v; RESMUST(make_dylan_vector(&v, ap, n)); return v; } -static obj_t aref(obj_t v, size_t i) { +static obj_t aref(obj_t v, size_t i) +{ return DYLAN_VECTOR_SLOT(v, i); } -static void aset(obj_t v, size_t i, obj_t val) { +static void aset(obj_t v, size_t i, obj_t val) +{ DYLAN_VECTOR_SLOT(v, i) = val; } /* mktree - make a tree of nodes with depth d. */ -static obj_t mktree(mps_ap_t ap, unsigned d, obj_t leaf) { +static obj_t mktree(mps_ap_t ap, unsigned d, obj_t leaf) +{ obj_t tree; size_t i; if (d <= 0) @@ -98,7 +102,8 @@ static obj_t mktree(mps_ap_t ap, unsigned d, obj_t leaf) { return tree; } -static obj_t random_subtree(obj_t tree, unsigned levels) { +static obj_t random_subtree(obj_t tree, unsigned levels) +{ while(tree != objNULL && levels > 0) { tree = aref(tree, rnd() % width); --levels; @@ -114,7 +119,8 @@ static obj_t random_subtree(obj_t tree, unsigned levels) { * NOTE: Changing preuse will dramatically change how much work * is done. In particular, if preuse==1, the old tree is returned * unchanged. */ -static obj_t new_tree(mps_ap_t ap, obj_t oldtree, unsigned d) { +static obj_t new_tree(mps_ap_t ap, obj_t oldtree, unsigned d) +{ obj_t subtree; size_t i; if (rnd_double() < preuse) { @@ -133,7 +139,8 @@ static obj_t new_tree(mps_ap_t ap, obj_t oldtree, unsigned d) { /* Update tree to be identical tree but with nodes reallocated * with probability pupdate. This avoids writing to vector slots * if unecessary. */ -static obj_t update_tree(mps_ap_t ap, obj_t oldtree, unsigned d) { +static obj_t update_tree(mps_ap_t ap, obj_t oldtree, unsigned d) +{ obj_t tree; size_t i; if (oldtree == objNULL || d == 0) @@ -156,7 +163,8 @@ static obj_t update_tree(mps_ap_t ap, obj_t oldtree, unsigned d) { return tree; } -static void *gc_tree(gcthread_t thread) { +static void *gc_tree(gcthread_t thread) +{ unsigned i, j; mps_ap_t ap = thread->ap; obj_t leaf = pinleaf ? mktree(ap, 1, objNULL) : objNULL; @@ -173,7 +181,8 @@ static void *gc_tree(gcthread_t thread) { } /* start -- start routine for each thread */ -static void *start(void *p) { +static void *start(void *p) +{ gcthread_t thread = p; void *marker; RESMUST(mps_thread_reg(&thread->mps_thread, arena)); @@ -296,7 +305,8 @@ static struct { /* Command-line driver */ -int main(int argc, char *argv[]) { +int main(int argc, char *argv[]) +{ int ch; unsigned i; mps_bool_t seed_specified = FALSE; diff --git a/mps/code/landtest.c b/mps/code/landtest.c index 7b7df522ab1..13742a54258 100644 --- a/mps/code/landtest.c +++ b/mps/code/landtest.c @@ -1,7 +1,7 @@ /* landtest.c: LAND TEST * * $Id$ - * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * Test all three Land implementations against duplicate operations on * a bit-table. @@ -62,7 +62,8 @@ static Index (indexOfAddr)(TestState state, Addr a) } -static void describe(TestState state) { +static void describe(TestState state) +{ die(LandDescribe(state->land, mps_lib_get_stdout(), 0), "LandDescribe"); } @@ -386,7 +387,8 @@ static void find(TestState state, Size size, Bool high, FindDelete findDelete) } } -static void test(TestState state, unsigned n) { +static void test(TestState state, unsigned n) +{ Addr base, limit; unsigned i; Size size; @@ -427,7 +429,7 @@ static void test(TestState state, unsigned n) { #define testArenaSIZE (((size_t)4)<<20) -extern int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { mps_arena_t mpsArena; Arena arena; @@ -543,7 +545,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2016 Ravenbrook Limited . + * Copyright (c) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/messtest.c b/mps/code/messtest.c index ed796360509..0958d9319c7 100644 --- a/mps/code/messtest.c +++ b/mps/code/messtest.c @@ -1,7 +1,7 @@ /* messtest.c: MESSAGE TEST * * $Id$ - * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. */ #include "mpm.h" @@ -254,7 +254,7 @@ static void testGetEmpty(Arena arena) #define testArenaSIZE (((size_t)64)<<20) -extern int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { mps_arena_t mpsArena; Arena arena; @@ -276,7 +276,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2016 Ravenbrook Limited . + * Copyright (c) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/nailboardtest.c b/mps/code/nailboardtest.c index aae9dc7be32..738d1436c40 100644 --- a/mps/code/nailboardtest.c +++ b/mps/code/nailboardtest.c @@ -1,7 +1,7 @@ /* nailboardtest.c: NAILBOARD TEST * * $Id$ - * Copyright (c) 2014-2016 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2014-2018 Ravenbrook Limited. See end of file for license. * */ @@ -54,7 +54,7 @@ static void test(mps_arena_t arena) die(NailboardDescribe(board, mps_lib_get_stdout(), 0), "NailboardDescribe"); } -int main(int argc, char **argv) +int main(int argc, char *argv[]) { mps_arena_t arena; @@ -73,7 +73,7 @@ int main(int argc, char **argv) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2014-2016 Ravenbrook Limited . + * Copyright (c) 2014-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index 77e009716e6..c384709a9c5 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c @@ -476,7 +476,8 @@ static void MVTFinish(Inst inst) /* MVTNoteFill -- record that a buffer fill has occurred */ -static void MVTNoteFill(MVT mvt, Addr base, Addr limit, Size minSize) { +static void MVTNoteFill(MVT mvt, Addr base, Addr limit, Size minSize) +{ mvt->available -= AddrOffset(base, limit); mvt->allocated += AddrOffset(base, limit); AVER(mvt->size == mvt->allocated + mvt->available + mvt->unavailable); diff --git a/mps/code/protxc.c b/mps/code/protxc.c index c02a76494e3..a02824ee2ef 100644 --- a/mps/code/protxc.c +++ b/mps/code/protxc.c @@ -278,7 +278,8 @@ static void protCatchOne(void) */ ATTRIBUTE_NORETURN -static void *protCatchThread(void *p) { +static void *protCatchThread(void *p) +{ UNUSED(p); for (;;) protCatchOne(); @@ -287,7 +288,7 @@ static void *protCatchThread(void *p) { /* ProtThreadRegister -- register a thread for protection exception handling */ -extern void ProtThreadRegister(void) +void ProtThreadRegister(void) { kern_return_t kr; mach_msg_type_number_t old_exception_count = 1; diff --git a/mps/code/pthrdext.c b/mps/code/pthrdext.c index d35b8928098..176a5d51b8d 100644 --- a/mps/code/pthrdext.c +++ b/mps/code/pthrdext.c @@ -159,7 +159,7 @@ static void PThreadextModuleInit(void) /* PThreadextCheck -- check the consistency of a PThreadext structure */ -extern Bool PThreadextCheck(PThreadext pthreadext) +Bool PThreadextCheck(PThreadext pthreadext) { int status; @@ -193,7 +193,7 @@ extern Bool PThreadextCheck(PThreadext pthreadext) /* PThreadextInit -- Initialize a pthreadext */ -extern void PThreadextInit(PThreadext pthreadext, pthread_t id) +void PThreadextInit(PThreadext pthreadext, pthread_t id) { int status; @@ -215,7 +215,7 @@ extern void PThreadextInit(PThreadext pthreadext, pthread_t id) * See */ -extern void PThreadextFinish(PThreadext pthreadext) +void PThreadextFinish(PThreadext pthreadext) { int status; diff --git a/mps/code/splay.c b/mps/code/splay.c index d0fd563eccd..0bb574e7aec 100644 --- a/mps/code/splay.c +++ b/mps/code/splay.c @@ -752,7 +752,8 @@ static Compare SplaySplay(SplayTree splay, TreeKey key, * a good thing for key neighbours to be tree neighbours. */ -Bool SplayTreeInsert(SplayTree splay, Tree node) { +Bool SplayTreeInsert(SplayTree splay, Tree node) +{ Tree neighbour; AVERT(SplayTree, splay); @@ -808,7 +809,8 @@ Bool SplayTreeInsert(SplayTree splay, Tree node) { * avoid a search for a replacement in more cases. */ -Bool SplayTreeDelete(SplayTree splay, Tree node) { +Bool SplayTreeDelete(SplayTree splay, Tree node) +{ Tree leftLast; Compare cmp; @@ -855,7 +857,8 @@ Bool SplayTreeDelete(SplayTree splay, Tree node) { * node in the tree, otherwise ``*nodeReturn`` will be set to the node. */ -Bool SplayTreeFind(Tree *nodeReturn, SplayTree splay, TreeKey key) { +Bool SplayTreeFind(Tree *nodeReturn, SplayTree splay, TreeKey key) +{ AVERT(SplayTree, splay); AVER(nodeReturn != NULL); @@ -876,7 +879,8 @@ Bool SplayTreeFind(Tree *nodeReturn, SplayTree splay, TreeKey key) { * in which case TreeEMPTY is returned, and the tree is unchanged. */ -static Tree SplayTreeSuccessor(SplayTree splay) { +static Tree SplayTreeSuccessor(SplayTree splay) +{ Tree oldRoot, newRoot; AVERT(SplayTree, splay); @@ -992,7 +996,8 @@ Bool SplayTreeNeighbours(Tree *leftReturn, Tree *rightReturn, * shape caused by previous splays. Consider using TreeTraverse instead. */ -Tree SplayTreeFirst(SplayTree splay) { +Tree SplayTreeFirst(SplayTree splay) +{ Tree node; AVERT(SplayTree, splay); @@ -1008,7 +1013,8 @@ Tree SplayTreeFirst(SplayTree splay) { return node; } -Tree SplayTreeNext(SplayTree splay, TreeKey oldKey) { +Tree SplayTreeNext(SplayTree splay, TreeKey oldKey) +{ AVERT(SplayTree, splay); if (SplayTreeIsEmpty(splay)) diff --git a/mps/code/table.c b/mps/code/table.c index b8d0576e759..a26ed499d13 100644 --- a/mps/code/table.c +++ b/mps/code/table.c @@ -1,7 +1,7 @@ /* table.h: A dictionary mapping a Word to a void* * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * .note.good-hash: As is common in hash table implementations, we * assume that the hash function is good. @@ -220,13 +220,9 @@ Res TableGrow(Table table, Count extraCapacity) /* TableCreate -- makes a new table */ -extern Res TableCreate(Table *tableReturn, - Count length, - TableAllocFunction tableAlloc, - TableFreeFunction tableFree, - void *allocClosure, - TableKey unusedKey, - TableKey deletedKey) +Res TableCreate(Table *tableReturn, Count length, + TableAllocFunction tableAlloc, TableFreeFunction tableFree, + void *allocClosure, TableKey unusedKey, TableKey deletedKey) { Table table; Res res; @@ -263,7 +259,7 @@ extern Res TableCreate(Table *tableReturn, /* TableDestroy -- destroy a table */ -extern void TableDestroy(Table table) +void TableDestroy(Table table) { AVER(table != NULL); if (table->length > 0) { @@ -279,7 +275,7 @@ extern void TableDestroy(Table table) /* TableLookup -- look up */ -extern Bool TableLookup(TableValue *valueReturn, Table table, TableKey key) +Bool TableLookup(TableValue *valueReturn, Table table, TableKey key) { TableEntry entry = tableFind(table, key, TRUE /* skip deleted */); @@ -292,7 +288,7 @@ extern Bool TableLookup(TableValue *valueReturn, Table table, TableKey key) /* TableDefine -- add a new mapping */ -extern Res TableDefine(Table table, TableKey key, TableValue value) +Res TableDefine(Table table, TableKey key, TableValue value) { TableEntry entry; @@ -326,7 +322,7 @@ extern Res TableDefine(Table table, TableKey key, TableValue value) /* TableRedefine -- redefine an existing mapping */ -extern Res TableRedefine(Table table, TableKey key, TableValue value) +Res TableRedefine(Table table, TableKey key, TableValue value) { TableEntry entry; @@ -344,7 +340,7 @@ extern Res TableRedefine(Table table, TableKey key, TableValue value) /* TableRemove -- remove a mapping */ -extern Res TableRemove(Table table, TableKey key) +Res TableRemove(Table table, TableKey key) { TableEntry entry; @@ -362,9 +358,9 @@ extern Res TableRemove(Table table, TableKey key) /* TableMap -- apply a function to all the mappings */ -extern void TableMap(Table table, - void (*fun)(void *closure, TableKey key, TableValue value), - void *closure) +void TableMap(Table table, + void (*fun)(void *closure, TableKey key, TableValue value), + void *closure) { Index i; for (i = 0; i < table->length; i++) @@ -375,7 +371,7 @@ extern void TableMap(Table table, /* TableCount -- count the number of mappings in the table */ -extern Count TableCount(Table table) +Count TableCount(Table table) { return table->count; } @@ -383,7 +379,7 @@ extern Count TableCount(Table table) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/teletest.c b/mps/code/teletest.c index 1a6b1614553..8d811038b94 100644 --- a/mps/code/teletest.c +++ b/mps/code/teletest.c @@ -1,7 +1,7 @@ /* teletest.c: TELEMETRY TEST * * $Id$ - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * .source: The command parser here was taken and adapted from bttest.c. */ @@ -191,7 +191,7 @@ static void obeyCommand(char *command) #define testArenaSIZE (((size_t)64)<<20) -extern int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { testlib_init(argc, argv); @@ -216,7 +216,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/tree.c b/mps/code/tree.c index 3afea83bca3..ff5861076ad 100644 --- a/mps/code/tree.c +++ b/mps/code/tree.c @@ -1,7 +1,7 @@ /* tree.c: BINARY TREE IMPLEMENTATION * * $Id$ - * Copyright (C) 2014-2015 Ravenbrook Limited. See end of file for license. + * Copyright (C) 2014-2018 Ravenbrook Limited. See end of file for license. * * Simple binary trees with utilities, for use as building blocks. * Keep it simple, like Rings (see ring.h). @@ -408,7 +408,8 @@ void TreeRotateLeft(Tree *treeIO) * ordering. */ -void TreeRotateRight(Tree *treeIO) { +void TreeRotateRight(Tree *treeIO) +{ Tree tree, left; AVER(treeIO != NULL); @@ -568,7 +569,7 @@ void TreeTraverseAndDelete(Tree *treeIO, TreeVisitor visitor, /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2014-2015 Ravenbrook Limited . + * Copyright (C) 2014-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. *