code cleanup: Add new source file common.h for misc functions.

This commit is contained in:
Juho Hiltunen
2022-09-03 21:19:37 +03:00
parent 001ad3ab8d
commit c4d8976fbc
14 changed files with 103 additions and 21 deletions
+1 -12
View File
@@ -49,6 +49,7 @@
#include <espeak-ng/encoding.h>
#include "speech.h"
#include "common.h" // for GetFileLength
#include "dictionary.h" // for GetTranslatedPhonemeString, strncpy0
#include "espeak_command.h" // for delete_espeak_command, SetParameter
#include "event.h" // for event_declare, event_clear_all, eve...
@@ -302,18 +303,6 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE
return ENS_OK;
}
int GetFileLength(const char *filename)
{
struct stat statbuf;
if (stat(filename, &statbuf) != 0)
return -errno;
if (S_ISDIR(statbuf.st_mode))
return -EISDIR;
return statbuf.st_size;
}
ESPEAK_NG_API void espeak_ng_InitializePath(const char *path)
{