Skip to content

Commit

Permalink
Remove all unused code from main.c
Browse files Browse the repository at this point in the history
  • Loading branch information
techee committed Oct 8, 2016
1 parent ded5ea3 commit 580beba
Showing 1 changed file with 0 additions and 122 deletions.
122 changes: 0 additions & 122 deletions ctags/main/main.c
Expand Up @@ -22,70 +22,15 @@
*/
#include "general.h" /* must always come first */

/* To provide timings features if available.
*/
#ifdef HAVE_CLOCK
# ifdef HAVE_TIME_H
# include <time.h>
# endif
#else
# ifdef HAVE_TIMES
# ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
# endif
# endif
#endif

/* To provide directory searching for recursion feature.
*/

#ifdef HAVE_DIRENT_H
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> /* required by dirent.h */
# endif
# include <dirent.h> /* to declare opendir() */
#endif
#ifdef HAVE_DIRECT_H
# include <direct.h> /* to _getcwd() */
#endif
#ifdef HAVE_DIR_H
# include <dir.h> /* to declare findfirst() and findnext */
#endif
#ifdef HAVE_IO_H
# include <io.h> /* to declare _findfirst() */
#endif

#include <string.h>

#include "debug.h"
#include "entry.h"
#include "keyword.h"
#include "main.h"
#include "options.h"
#include "read.h"
#include "routines.h"

/*
* MACROS
*/
#define plural(value) (((unsigned long)(value) == 1L) ? "" : "s")

/*
* DATA DEFINITIONS
*/
static struct { long files, lines, bytes; } Totals = { 0, 0, 0 };

/*
* FUNCTION DEFINITIONS
*/

extern void addTotals (
const unsigned int files, const long unsigned int lines,
const long unsigned int bytes)
{
Totals.files += files;
Totals.lines += lines;
Totals.bytes += bytes;
}

extern bool isDestinationStdout (void)
Expand All @@ -99,70 +44,3 @@ extern bool isDestinationStdout (void)
toStdout = true;
return toStdout;
}

#if 0 /* Unused in Geany */

#if defined (HAVE_CLOCK)
# define CLOCK_AVAILABLE
# ifndef CLOCKS_PER_SEC
# define CLOCKS_PER_SEC 1000000
# endif
#elif defined (HAVE_TIMES)
# define CLOCK_AVAILABLE
# define CLOCKS_PER_SEC 60
static clock_t clock (void)
{
struct tms buf;

times (&buf);
return (buf.tms_utime + buf.tms_stime);
}
#else
# define clock() (clock_t)0
#endif

static void printTotals (const clock_t *const timeStamps)
{
const unsigned long totalTags = TagFile.numTags.added +
TagFile.numTags.prev;

fprintf (errout, "%ld file%s, %ld line%s (%ld kB) scanned",
Totals.files, plural (Totals.files),
Totals.lines, plural (Totals.lines),
Totals.bytes/1024L);
#ifdef CLOCK_AVAILABLE
{
const double interval = ((double) (timeStamps [1] - timeStamps [0])) /
CLOCKS_PER_SEC;

fprintf (errout, " in %.01f seconds", interval);
if (interval != (double) 0.0)
fprintf (errout, " (%lu kB/s)",
(unsigned long) (Totals.bytes / interval) / 1024L);
}
#endif
fputc ('\n', errout);

fprintf (errout, "%lu tag%s added to tag file",
TagFile.numTags.added, plural (TagFile.numTags.added));
if (Option.append)
fprintf (errout, " (now %lu tags)", totalTags);
fputc ('\n', errout);

if (totalTags > 0 && Option.sorted)
{
fprintf (errout, "%lu tag%s sorted", totalTags, plural (totalTags));
#ifdef CLOCK_AVAILABLE
fprintf (errout, " in %.02f seconds",
((double) (timeStamps [2] - timeStamps [1])) / CLOCKS_PER_SEC);
#endif
fputc ('\n', errout);
}

#ifdef DEBUG
fprintf (errout, "longest tag line = %lu\n",
(unsigned long) TagFile.max.line);
#endif
}

#endif /* Unused in Geany */

0 comments on commit 580beba

Please sign in to comment.