[geany/geany] 560107: Drop some more unused functions from routines.c/h

Jiří Techet git-noreply at xxxxx
Mon Dec 17 21:05:29 UTC 2018


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sat, 08 Oct 2016 12:12:35 UTC
Commit:      560107804ce5c081326624d3d6de433e0d5eb75d
             https://github.com/geany/geany/commit/560107804ce5c081326624d3d6de433e0d5eb75d

Log Message:
-----------
Drop some more unused functions from routines.c/h

Also get the error() implementation from error.c/h (modified slightly to
make sure exit() isn't called and which doesn't call errorPrinter() as
this one should be set somewhere else in the code and it doesn't happen
now).


Modified Paths:
--------------
    ctags/Makefile.am
    ctags/main/error.c
    ctags/main/error.h
    ctags/main/parse.c
    ctags/main/routines.c
    ctags/main/routines.h

Modified: ctags/Makefile.am
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -59,6 +59,8 @@ libctags_la_SOURCES = \
 	main/debug.h \
 	main/entry.c \
 	main/entry.h \
+	main/error.c \
+	main/error.h \
 	main/general.h \
 	main/keyword.c \
 	main/keyword.h \


Modified: ctags/main/error.c
59 lines changed, 59 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,59 @@
+/*
+*   Copyright (c) 2002-2003, Darren Hiebert
+*
+*   This source code is released for free distribution under the terms of the
+*   GNU General Public License version 2 or (at your option) any later version.
+*
+*   This module contains a lose assortment of shared functions.
+*/
+
+#include "general.h"  /* must always come first */
+#include <string.h>
+#include <errno.h>
+
+#include "error.h"
+#include "options.h"
+
+#define selected(var,feature)	(((int)(var) & (int)(feature)) == (int)feature)
+
+static errorPrintFunc errorPrinter;
+static void *errorPrinterData;
+
+extern void setErrorPrinter (errorPrintFunc printer, void *data)
+{
+	errorPrinter = printer;
+	errorPrinterData = data;
+}
+
+extern bool stderrDefaultErrorPrinter (const errorSelection selection,
+					  const char *const format,
+					  va_list ap, void *data CTAGS_ATTR_UNUSED)
+{
+	fprintf (stderr, "%s: %s", getExecutableName (),
+		 selected (selection, WARNING) ? "Warning: " : "");
+	vfprintf (stderr, format, ap);
+	if (selected (selection, PERROR))
+#ifdef HAVE_STRERROR
+		fprintf (stderr, " : %s", strerror (errno));
+#else
+	perror (" ");
+#endif
+	fputs ("\n", stderr);
+
+	return false;
+}
+
+extern void error (const errorSelection selection,
+		   const char *const format, ...)
+{
+	va_list ap;
+	bool shouldExit;
+
+	va_start (ap, format);
+	shouldExit = false;
+	va_end (ap);
+
+	if (shouldExit)
+		exit (1);
+}
+


Modified: ctags/main/error.h
26 lines changed, 26 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,26 @@
+/*
+*   Copyright (c) 2002-2003, Darren Hiebert
+*
+*   This source code is released for free distribution under the terms of the
+*   GNU General Public License version 2 or (at your option) any later version.
+*
+*   This module contains a lose assortment of shared functions.
+*/
+
+#ifndef CTAGS_MAIN_ERORR_H
+#define CTAGS_MAIN_ERORR_H
+
+#include "general.h"  /* must always come first */
+
+#include <stdarg.h>
+#include "routines.h"
+
+typedef bool (* errorPrintFunc) (const errorSelection selection, const char *const format,
+				    va_list ap, void *data);
+
+extern void setErrorPrinter (errorPrintFunc printer, void *data);
+
+extern bool stderrDefaultErrorPrinter (const errorSelection selection, const char *const format, va_list ap,
+					  void *data);
+
+#endif


Modified: ctags/main/parse.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -116,7 +116,7 @@ extern langType getNamedLanguage (const char *const name)
 	for (i = 0  ;  i < LanguageCount  &&  result == LANG_IGNORE  ;  ++i)
 	{
 		if (LanguageTable [i]->name != NULL)
-			if (stricmp (name, LanguageTable [i]->name) == 0)
+			if (strcasecmp (name, LanguageTable [i]->name) == 0)
 				result = i;
 	}
 	return result;


Modified: ctags/main/routines.c
146 lines changed, 0 insertions(+), 146 deletions(-)
===================================================================
@@ -661,111 +661,6 @@ extern char* relativeFilename (const char *file, const char *dir)
 	return res;
 }
 
-extern long unsigned int getFileSize (const char *const name)
-{
-	GStatBuf fileStatus;
-	unsigned long size = 0;
-
-	if (stat (name, &fileStatus) == 0)
-		size = fileStatus.st_size;
-
-	return size;
-}
-
-#if 0
-static bool isSymbolicLink (const char *const name)
-{
-#if defined (WIN32)
-	return false;
-#else
-	GStatBuf fileStatus;
-	bool result = false;
-
-	if (lstat (name, &fileStatus) == 0)
-		result = (bool) (S_ISLNK (fileStatus.st_mode));
-
-	return result;
-#endif
-}
-
-static bool isNormalFile (const char *const name)
-{
-	GStatBuf fileStatus;
-	bool result = false;
-
-	if (stat (name, &fileStatus) == 0)
-		result = (bool) (S_ISREG (fileStatus.st_mode));
-
-	return result;
-}
-#endif
-
-extern bool isExecutable (const char *const name)
-{
-	GStatBuf fileStatus;
-	bool result = false;
-
-	if (stat (name, &fileStatus) == 0)
-		result = (bool) ((fileStatus.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) != 0);
-
-	return result;
-}
-
-#ifdef HAVE_MKSTEMP
-
-static bool isSetUID (const char *const name)
-{
-#if defined (WIN32)
-	return false;
-#else
-	GStatBuf fileStatus;
-	bool result = false;
-
-	if (stat (name, &fileStatus) == 0)
-		result = (bool) ((fileStatus.st_mode & S_ISUID) != 0);
-
-	return result;
-#endif
-}
-
-#endif
-
-#if 0
-static bool isDirectory (const char *const name)
-{
-	bool result = false;
-	GStatBuf fileStatus;
-
-	if (stat (name, &fileStatus) == 0)
-		result = (bool) S_ISDIR (fileStatus.st_mode);
-	return result;
-}
-#endif
-
-/*#ifndef HAVE_FGETPOS*/
-/*
-extern int fgetpos ( stream, pos )
-	FILE *const stream;
-	fpos_t *const pos;
-{
-	int result = 0;
-
-	*pos = ftell (stream);
-	if (*pos == -1L)
-		result = -1;
-
-	return result;
-}
-
-extern int fsetpos ( stream, pos )
-	FILE *const stream;
-	fpos_t *const pos;
-{
-	return fseek (stream, *pos, SEEK_SET);
-}
-*/
-/*#endif*/
-
 extern FILE *tempFile (const char *const mode, char **const pName)
 {
 	char *name;
@@ -815,44 +710,3 @@ extern FILE *tempFile (const char *const mode, char **const pName)
 	*pName = name;
 	return fp;
 }
-
-extern void error (const errorSelection selection,
-				   const char *const format, ...)
-{
-	va_list ap;
-
-	va_start (ap, format);
-	fprintf (errout, "%s: %s", getExecutableName (),
-			selected (selection, WARNING) ? "Warning: " : "");
-	vfprintf (errout, format, ap);
-	if (selected (selection, PERROR))
-		fprintf (errout, " : %s", g_strerror (errno));
-	fputs ("\n", errout);
-	va_end (ap);
-	if (selected (selection, FATAL))
-		exit (1);
-}
-
-#ifndef HAVE_STRICMP
-extern int stricmp (const char *s1, const char *s2)
-{
-	int result;
-	do
-	{
-		result = toupper ((int) *s1) - toupper ((int) *s2);
-	} while (result == 0  &&  *s1++ != '\0'  &&  *s2++ != '\0');
-	return result;
-}
-#endif
-
-#ifndef HAVE_STRNICMP
-extern int strnicmp (const char *s1, const char *s2, size_t n)
-{
-	int result;
-	do
-	{
-		result = toupper ((int) *s1) - toupper ((int) *s2);
-	} while (result == 0  &&  --n > 0  &&  *s1++ != '\0'  &&  *s2++ != '\0');
-	return result;
-}
-#endif


Modified: ctags/main/routines.h
16 lines changed, 4 insertions(+), 12 deletions(-)
===================================================================
@@ -102,6 +102,9 @@ extern void *eMalloc (const size_t size);
 extern void *eCalloc (const size_t count, const size_t size);
 extern void *eRealloc (void *const ptr, const size_t size);
 extern void eFree (void *const ptr);
+#ifndef HAVE_STRSTR
+extern char* strstr (const char *str, const char *substr);
+#endif
 extern void toLowerString (char* str);
 extern void toUpperString (char* str);
 extern char* newLowerString (const char* str);
@@ -114,24 +117,13 @@ extern bool doesFileExist (const char *const fileName);
 extern bool isRecursiveLink (const char* const dirName);
 extern bool isSameFile (const char *const name1, const char *const name2);
 extern const char *baseFilename (const char *const filePath);
+extern const char *fileExtension (const char *const fileName);
 extern bool isAbsolutePath (const char *const path);
 extern vString *combinePathAndFile (const char *const path, const char *const file);
 extern char* absoluteFilename (const char *file);
 extern char* absoluteDirname (char *file);
 extern char* relativeFilename (const char *file, const char *dir);
 extern FILE *tempFile (const char *const mode, char **const pName);
-extern void processExcludeOption (const char *const option, const char *const parameter);
-extern const char *fileExtension (const char *const fileName);
 extern char* eStrdup (const char* str);
 
-#ifndef HAVE_STRICMP
-extern int stricmp (const char *s1, const char *s2);
-#endif
-#ifndef HAVE_STRNICMP
-extern int strnicmp (const char *s1, const char *s2, size_t n);
-#endif
-#ifndef HAVE_STRSTR
-extern char* strstr (const char *str, const char *substr);
-#endif
-
 #endif  /* CTAGS_MAIN_ROUTINES_H */



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list