summaryrefslogtreecommitdiff
path: root/3rdparty/libconfig/scanctx.c
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/libconfig/scanctx.c')
-rw-r--r--3rdparty/libconfig/scanctx.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/3rdparty/libconfig/scanctx.c b/3rdparty/libconfig/scanctx.c
index f2fe8cd80..94ba73edd 100644
--- a/3rdparty/libconfig/scanctx.c
+++ b/3rdparty/libconfig/scanctx.c
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2013-2015 Hercules Dev Team
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2013-2016 Hercules Dev Team
+ Copyright (C) 2005-2014 Mark A Lindner
This file is part of libconfig.
@@ -38,31 +38,27 @@ static const char *err_include_too_deep = "include file nesting too deep";
/* ------------------------------------------------------------------------- */
static const char *__scanctx_add_filename(struct scan_context *ctx,
- const char *filename)
+ char *filename)
{
-#ifndef __clang_analyzer__ // FIXME: Clang's static analyzer doesn't like this
unsigned int count = ctx->num_filenames;
- const char **f;
+ char **f;
for(f = ctx->filenames; count > 0; ++f, --count)
{
if(!strcmp(*f, filename))
{
- free((void *)filename);
+ free(filename);
return(*f); /* already in list */
}
}
if((ctx->num_filenames % CHUNK_SIZE) == 0)
{
- ctx->filenames = (const char **)realloc(
- (void *)ctx->filenames,
- (ctx->num_filenames + CHUNK_SIZE) * sizeof(const char *));
+ ctx->filenames = realloc(ctx->filenames, (ctx->num_filenames + CHUNK_SIZE) * sizeof(char *));
}
ctx->filenames[ctx->num_filenames] = filename;
++ctx->num_filenames;
-#endif // __clang_analyzer__
return(filename);
}
@@ -77,8 +73,8 @@ void scanctx_init(struct scan_context *ctx, const char *top_filename)
/* ------------------------------------------------------------------------- */
-const char **scanctx_cleanup(struct scan_context *ctx,
- unsigned int *num_filenames)
+char **scanctx_cleanup(struct scan_context *ctx,
+ unsigned int *num_filenames)
{
int i;
@@ -97,7 +93,7 @@ FILE *scanctx_push_include(struct scan_context *ctx, void *buffer,
const char **error)
{
FILE *fp = NULL;
- const char *file;
+ char *file;
char *full_file = NULL;
*error = NULL;
@@ -119,7 +115,7 @@ FILE *scanctx_push_include(struct scan_context *ctx, void *buffer,
}
fp = fopen(full_file ? full_file : file, "rt");
- free((void *)full_file);
+ free(full_file);
if(fp)
{
@@ -130,7 +126,7 @@ FILE *scanctx_push_include(struct scan_context *ctx, void *buffer,
}
else
{
- free((void *)file);
+ free(file);
*error = err_bad_include;
}
@@ -170,4 +166,3 @@ const char *scanctx_current_filename(struct scan_context *ctx)
}
/* ------------------------------------------------------------------------- */
-/* eof */