From 8447d3fb9080b78683464cb55daef3076261fe20 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Fri, 1 Apr 2022 15:07:56 +0200 Subject: [PATCH] Remove unused JackArgParser::GetArgv This is not called anywhere. Also this function doesn't do anything useful besides leaking memory in its current form. I think the idea was to give this a `char ***` (instead of `char **`) paramter that will be filled and then can be used by the caller. But in its current form it just allocates a pointer with the address being only used in the local variable (which then goes out of scope and the memory is lost). --- common/JackArgParser.cpp | 20 -------------------- common/JackArgParser.h | 1 - 2 files changed, 21 deletions(-) diff --git a/common/JackArgParser.cpp b/common/JackArgParser.cpp index 2ca25c26..4ecf86a6 100644 --- a/common/JackArgParser.cpp +++ b/common/JackArgParser.cpp @@ -121,26 +121,6 @@ namespace Jack { return 0; } - int JackArgParser::GetArgv ( char** argv ) - { - //argv must be NULL - if ( argv ) - return -1; - //else allocate and fill it - argv = (char**)calloc (fArgv.size(), sizeof(char*)); - if (argv == NULL) - { - return -1; - } - for ( unsigned int i = 0; i < fArgv.size(); i++ ) - { - argv[i] = (char*)calloc(fArgv[i].length(), sizeof(char)); - fill_n ( argv[i], fArgv[i].length() + 1, 0 ); - fArgv[i].copy ( argv[i], fArgv[i].length() ); - } - return 0; - } - void JackArgParser::DeleteArgv ( const char** argv ) { unsigned int i; diff --git a/common/JackArgParser.h b/common/JackArgParser.h index 2226eaea..4ea89d02 100644 --- a/common/JackArgParser.h +++ b/common/JackArgParser.h @@ -50,7 +50,6 @@ namespace Jack int GetNumArgv(); int GetArgc(); int GetArgv ( std::vector& argv ); - int GetArgv ( char** argv ); void DeleteArgv ( const char** argv ); bool ParseParams ( jack_driver_desc_t* desc, JSList** param_list ); void FreeParams ( JSList* param_list );