diff mbox series

util: remove unused method isDirectoryEmpty()

Message ID 20170908074122.25961-1-christian.storm@siemens.com
State Accepted
Headers show
Series util: remove unused method isDirectoryEmpty() | expand

Commit Message

Storm, Christian Sept. 8, 2017, 7:41 a.m. UTC
The isDirectoryEmpty() method is not used and is inconsistently
named, remove it.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 core/util.c    | 21 ---------------------
 include/util.h |  1 -
 2 files changed, 22 deletions(-)

Comments

Stefano Babic Sept. 12, 2017, 9:27 a.m. UTC | #1
On 08/09/2017 09:41, Christian Storm wrote:
> The isDirectoryEmpty() method is not used and is inconsistently
> named, remove it.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  core/util.c    | 21 ---------------------
>  include/util.h |  1 -
>  2 files changed, 22 deletions(-)
> 
> diff --git a/core/util.c b/core/util.c
> index b714f29..5590f8b 100644
> --- a/core/util.c
> +++ b/core/util.c
> @@ -112,27 +112,6 @@ int openfileoutput(const char *filename)
>  	return fdout;
>  }
>  
> -int isDirectoryEmpty(const char *dirname)
> -{
> -	int n = 0;
> -	struct dirent *d;
> -	DIR *dir = opendir(dirname);
> -
> -	if (dir == NULL)
> -		return 1;
> -
> -	while ((d = readdir(dir)) != NULL) {
> -		if(++n > 2)
> -			break;
> -  	}
> -	closedir(dir);
> -
> -	if (n <= 2)
> -		return 1;
> -
> -	return 0;
> -}
> -
>  /*
>   * This function is strict bounded with the hardware
>   * It reads some GPIOs to get the hardware revision
> diff --git a/include/util.h b/include/util.h
> index 70a0acc..082a962 100644
> --- a/include/util.h
> +++ b/include/util.h
> @@ -163,7 +163,6 @@ int syslog_init(void);
>  char **splitargs(char *args, int *argc);
>  char** string_split(char* a_str, const char a_delim);
>  void freeargs (char **argv);
> -int isDirectoryEmpty(const char *dirname);
>  int get_hw_revision(struct hw_type *hw);
>  void get_sw_versions(char *cfgfname, struct swupdate_cfg *sw);
>  int check_hw_compatibility(struct swupdate_cfg *cfg);
> 
Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/core/util.c b/core/util.c
index b714f29..5590f8b 100644
--- a/core/util.c
+++ b/core/util.c
@@ -112,27 +112,6 @@  int openfileoutput(const char *filename)
 	return fdout;
 }
 
-int isDirectoryEmpty(const char *dirname)
-{
-	int n = 0;
-	struct dirent *d;
-	DIR *dir = opendir(dirname);
-
-	if (dir == NULL)
-		return 1;
-
-	while ((d = readdir(dir)) != NULL) {
-		if(++n > 2)
-			break;
-  	}
-	closedir(dir);
-
-	if (n <= 2)
-		return 1;
-
-	return 0;
-}
-
 /*
  * This function is strict bounded with the hardware
  * It reads some GPIOs to get the hardware revision
diff --git a/include/util.h b/include/util.h
index 70a0acc..082a962 100644
--- a/include/util.h
+++ b/include/util.h
@@ -163,7 +163,6 @@  int syslog_init(void);
 char **splitargs(char *args, int *argc);
 char** string_split(char* a_str, const char a_delim);
 void freeargs (char **argv);
-int isDirectoryEmpty(const char *dirname);
 int get_hw_revision(struct hw_type *hw);
 void get_sw_versions(char *cfgfname, struct swupdate_cfg *sw);
 int check_hw_compatibility(struct swupdate_cfg *cfg);