From f63afb440a9d15c334c65e51af2a435671a1b846 Mon Sep 17 00:00:00 2001 From: Per Cederqvist Date: Wed, 8 Jul 1998 16:21:43 +0000 Subject: [PATCH] Include dbck-cache.h. (rcsid): Added a missing const. (next_text_num): Changed type from int to Text_no. (TEXT_RANGE): Adjusted printf format for next_text_num change. (VOID_TEXT_RANGE): Likewise. (cache_sync): Changed type of local variable i from int to unsigned long. Removed extern declaration of oformat. Adjusted printf formats for next_text_num change. (init_cache): Removed extern declaration of oformat. Adjusted printf formats for next_text_num change. --- src/server/dbck-cache.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/server/dbck-cache.c b/src/server/dbck-cache.c index 31026df3..ac40f3b2 100644 --- a/src/server/dbck-cache.c +++ b/src/server/dbck-cache.c @@ -1,5 +1,5 @@ /* - * $Id: dbck-cache.c,v 0.29 1997/09/13 15:32:03 byers Exp $ + * $Id: dbck-cache.c,v 0.30 1998/07/08 16:21:43 ceder Exp $ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -32,7 +32,8 @@ * Also save time as a time_t instead of a struct tm. */ -static char *rcsid = "$Id: dbck-cache.c,v 0.29 1997/09/13 15:32:03 byers Exp $"; +static const char * +rcsid = "$Id: dbck-cache.c,v 0.30 1998/07/08 16:21:43 ceder Exp $"; #include "rcs.h" USE(rcsid); @@ -75,6 +76,7 @@ USE(rcsid); #include "ram-parse.h" #include "ram-output.h" #include "param.h" +#include "dbck-cache.h" /* * All functions that can fail sets kom_errno to a suitable value @@ -89,7 +91,7 @@ String name_list [ MAX_CONF ]; /* "cache" list */ int next_free_num = 1; Text_stat * text_arr[ MAX_TEXT ]; -int next_text_num = 1; +static Text_no next_text_num = 1; Info kom_info = { @@ -128,7 +130,7 @@ BUGDECL; #define TEXT_RANGE(str, num, retval) if ( num == 0 || num >= next_text_num ) \ { \ return retval;\ - printf("Text_no out of range 1 ... %d ", next_text_num); \ + printf("Text_no out of range 1 ... %ld ", next_text_num); \ printf(str); \ fflush(stdout); \ fflush(stderr); \ @@ -138,7 +140,7 @@ BUGDECL; #define VOID_TEXT_RANGE(str, num) if ( num == 0 || num >= next_text_num ) \ { \ return;\ - printf("Text_no out of range 1 ... %d ", next_text_num); \ + printf("Text_no out of range 1 ... %ld ", next_text_num); \ printf(str); \ fflush(stdout); \ fflush(stderr); \ @@ -562,8 +564,7 @@ extern void /* Write out everything. */ cache_sync(void) { FILE *fp; - int i; - extern long oformat; + unsigned long i; #ifdef TIME_SYNC struct rusage start, after_confs, after_persons, after_text_stats, @@ -604,7 +605,7 @@ cache_sync(void) case 1: fprintf(fp, "DIRTY:%05ld\n", oformat); fprintf(fp, "#C %d\n", next_free_num); - fprintf(fp, "#T %d\n", next_text_num); + fprintf(fp, "#T %ld\n", next_text_num); fprintf(fp, "I"); foutput_info(fp, &kom_info); fprintf(fp, "\n"); @@ -687,7 +688,7 @@ cache_sync(void) switch (oformat) { case 0: - fprintf(fp, "%d\n", next_text_num); /* NEXT_TEXT_NUM */ + fprintf(fp, "%ld\n", next_text_num); /* NEXT_TEXT_NUM */ break; case 1: break; @@ -806,7 +807,6 @@ init_cache(void) long data_file_version; char done, read_text_num, read_conf_num, c; extern int modifications; - extern long oformat; extern int pers_pres_conf; extern int conf_pres_conf; extern int motd_conf; @@ -1215,7 +1215,7 @@ init_cache(void) read_text_num = 1; if ( vflag ) - log("Reading %d texts, starting at pos %lu.\n", + log("Reading %ld texts, starting at pos %lu.\n", next_text_num-1, (unsigned long)ftell(fp)); for ( i = 1; i < next_text_num; i++ ) /* TEXT_STATS */ @@ -1245,7 +1245,7 @@ init_cache(void) } } /* if (datafile_version == 0) */ - log("Read %d confs/persons and %d texts, eof at %lu\n", + log("Read %d confs/persons and %ld texts, eof at %lu\n", next_free_num-1, next_text_num-1, (unsigned long)ftell(fp)); if (read_text_num == 0 || read_conf_num == 0) -- GitLab