Skip to content

Commit

Permalink
Merge pull request #20 from chrstphrchvz/c23ok
Browse files Browse the repository at this point in the history
Use prototypes in function declarations/definitions
  • Loading branch information
bovine committed Jan 18, 2024
2 parents 0f6ff65 + 64fea04 commit 10b0bea
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 112 deletions.
8 changes: 4 additions & 4 deletions compat/getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ char *optarg; /* argument associated with option */
* Parse argc/argv argument vector.
*/
int
getopt(nargc, nargv, ostr)
int nargc;
char * const *nargv;
const char *ostr;
getopt(
int nargc,
char * const *nargv,
const char *ostr)
{
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
Expand Down
15 changes: 7 additions & 8 deletions compat/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

#include <stdio.h>

long random();
long random(void);

typedef unsigned int u_int;

Expand Down Expand Up @@ -243,10 +243,10 @@ srandom(x)
* Returns a pointer to the old state.
*/
char *
initstate(seed, arg_state, n)
u_int seed; /* seed for R.N.G. */
char *arg_state; /* pointer to state array */
int n; /* # bytes of state info */
initstate(
u_int seed, /* seed for R.N.G. */
char *arg_state, /* pointer to state array */
int n) /* # bytes of state info */
{
register char *ostate = (char *)(&state[-1]);

Expand Down Expand Up @@ -306,8 +306,7 @@ initstate(seed, arg_state, n)
* Returns a pointer to the old state information.
*/
char *
setstate(arg_state)
char *arg_state;
setstate(char *arg_state)
{
register long *new_state = (long *)arg_state;
register int type = new_state[0] % MAX_TYPES;
Expand Down Expand Up @@ -359,7 +358,7 @@ setstate(arg_state)
* Returns a 31-bit random number.
*/
long
random()
random(void)
{
long i;

Expand Down
5 changes: 3 additions & 2 deletions compat/rename.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
*
*/

int rename(from,to)
register char *from, *to;
int rename(
register char *from,
register char *to)
{
(void) unlink(to);
if (link(from, to) < 0)
Expand Down
4 changes: 2 additions & 2 deletions generic/tclXkeylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ ValidateKey (Tcl_Interp *interp, char *key, int keyLen)
*-----------------------------------------------------------------------------
*/
static keylIntObj_t *
AllocKeyedListIntRep ()
AllocKeyedListIntRep (void)
{
keylIntObj_t *keylIntPtr;

Expand Down Expand Up @@ -674,7 +674,7 @@ UpdateStringOfKeyedList (Tcl_Obj *keylPtr)
*-----------------------------------------------------------------------------
*/
Tcl_Obj *
TclX_NewKeyedListObj ()
TclX_NewKeyedListObj (void)
{
Tcl_Obj *keylPtr = Tcl_NewObj ();
keylIntObj_t *keylIntPtr = AllocKeyedListIntRep ();
Expand Down
3 changes: 1 addition & 2 deletions generic/tclXprofile.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,7 @@ RecordData (profInfo_t *infoPtr,
*-----------------------------------------------------------------------------
*/
static void
PopEntry (infoPtr)
profInfo_t *infoPtr;
PopEntry (profInfo_t *infoPtr)
{
profEntry_t *entryPtr = infoPtr->stackPtr;

Expand Down
2 changes: 1 addition & 1 deletion generic/tclXsignal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ SignalCmdCleanUp (ClientData clientData, Tcl_Interp *interp)
*-----------------------------------------------------------------------------
*/
void
TclX_SetupSigInt ()
TclX_SetupSigInt (void)
{
signalProcPtr_t actionFunc;
int restart;
Expand Down
3 changes: 1 addition & 2 deletions unix/tclXunixCmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ TclX_TimesObjCmd (ClientData clientData,
*-----------------------------------------------------------------------------
*/
void
TclX_PlatformCmdsInit (interp)
Tcl_Interp *interp;
TclX_PlatformCmdsInit (Tcl_Interp *interp)
{
Tcl_CreateObjCommand (interp,
"chroot",
Expand Down
4 changes: 2 additions & 2 deletions unix/tclXunixOS.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ TclXOSsleep (unsigned seconds)
*-----------------------------------------------------------------------------
*/
void
TclXOSsync ()
TclXOSsync (void)
{
sync ();
}
Expand Down Expand Up @@ -1387,7 +1387,7 @@ TclXOSGetSelectFnum (Tcl_Interp *interp, Tcl_Channel channel, int direction, int
*-----------------------------------------------------------------------------
*/
int
TclXOSHaveFlock ()
TclXOSHaveFlock (void)
{
#ifdef F_SETLKW
return TRUE;
Expand Down
2 changes: 1 addition & 1 deletion unix/tclXunixSock.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ TclX_ServerInit (Tcl_Interp *interp)
Tcl_CreateCommand (interp, "server_accept", TclX_ServerAcceptCmd,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand (interp, "server_create", TclX_ServerCreateCmd,
(ClientData) NULL, (void (*)()) NULL);
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
}

/* vim: set ts=4 sw=4 sts=4 et : */
5 changes: 2 additions & 3 deletions win/cattcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@
*-----------------------------------------------------------------------------
*/
void
TclX_SplitWinCmdLine (argcPtr, argvPtr)
int *argcPtr;
char ***argvPtr;
TclX_SplitWinCmdLine (int *argcPtr;
char ***argvPtr;
{
char *args = GetCommandLine ();
char **argvlist, *p;
Expand Down
3 changes: 1 addition & 2 deletions win/tclXwinCmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ TclX_TimesObjCmd (ClientData clientData,
*-----------------------------------------------------------------------------
*/
void
TclX_PlatformCmdsInit (interp)
Tcl_Interp *interp;
TclX_PlatformCmdsInit (Tcl_Interp *interp)
{
Tcl_CreateObjCommand (interp,
"chroot",
Expand Down
14 changes: 6 additions & 8 deletions win/tclXwinDup.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@ ConvertChannelName (Tcl_Interp *interp,
*-----------------------------------------------------------------------------
*/
Tcl_Channel
TclXOSDupChannel (interp, srcChannel, mode, targetChannelId)
Tcl_Interp *interp;
Tcl_Channel srcChannel;
int mode;
char *targetChannelId;
TclXOSDupChannel (Tcl_Interp *interp,
Tcl_Channel srcChannel,
int mode,
char *targetChannelId)
{
Tcl_Channel newChannel = NULL;
int direction;
Expand Down Expand Up @@ -175,9 +174,8 @@ TclXOSDupChannel (interp, srcChannel, mode, targetChannelId)
*-----------------------------------------------------------------------------
*/
Tcl_Channel
TclXOSBindOpenFile (interp, fileNum)
Tcl_Interp *interp;
int fileNum;
TclXOSBindOpenFile (Tcl_Interp *interp,
int fileNum)
{
HANDLE fileHandle;
int mode, isSocket;
Expand Down
26 changes: 11 additions & 15 deletions win/tclXwinId.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ TclX_IdObjCmd (ClientData clientData,
* id process
*/
static int
IdProcess (interp, objc, objv)
Tcl_Interp *interp;
int objc;
Tcl_Obj *const objv[];
IdProcess (Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *resultPtr = Tcl_GetObjResult (interp);

Expand All @@ -74,10 +73,9 @@ IdProcess (interp, objc, objv)
* id host
*/
static int
IdHost (interp, objc, objv)
Tcl_Interp *interp;
int objc;
Tcl_Obj *const objv[];
IdHost (Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
char hostName [TCL_RESULT_SIZE];

Expand All @@ -96,11 +94,10 @@ IdHost (interp, objc, objv)
}

static int
TclX_IdObjCmd (clientData, interp, objc, objv)
ClientData clientData;
Tcl_Interp *interp;
int objc;
Tcl_Obj *const objv[];
TclX_IdObjCmd (ClientData clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
char *optionPtr;

Expand Down Expand Up @@ -139,8 +136,7 @@ TclX_IdObjCmd (clientData, interp, objc, objv)
*-----------------------------------------------------------------------------
*/
void
TclX_IdInit (interp)
Tcl_Interp *interp;
TclX_IdInit (Tcl_Interp *interp)
{
Tcl_CreateObjCommand (interp,
"id",
Expand Down

0 comments on commit 10b0bea

Please sign in to comment.