Skip to contentSkip to conversation

lib/signames: remove unused function

PATCH In review Sami Kerola 2 participants 4 messages Nov 26, 2017 – Nov 28, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 lib/signames: remove unused function

---
 include/signames.h | 1 -
 lib/signames.c     | 5 -----
 2 files changed, 6 deletions(-)
include/signames.h +0 -1
index 2096ad845..a4fd1bc59 100644
@@ -3,7 +3,6 @@
 
 int signame_to_signum(const char *sig);
 const char *signum_to_signame(int signum);
-size_t get_numof_signames(void);
 int get_signame_by_idx(size_t idx, const char **signame, int *signum);
 
 #endif /* SIGNAMES_H */
lib/signames.c +0 -5
index a654e88b1..316eec527 100644
@@ -189,11 +189,6 @@ const char *signum_to_signame(int signum)
 	return NULL;
 }
 
-size_t get_numof_signames(void)
-{
-	return ARRAY_SIZE(ul_signames);
-}
-
 int get_signame_by_idx(size_t idx, const char **signame, int *signum)
 {
 	if (idx >= ARRAY_SIZE(ul_signames))
Signature · 1 line
2.15.0
#1 lore raw

PATCH 2/3 logindefs: remove unused function

---
 login-utils/logindefs.c | 18 ------------------
 login-utils/logindefs.h |  1 -
 2 files changed, 19 deletions(-)
login-utils/logindefs.c +0 -18
index ebf1a9f3a..18a699d6b 100644
@@ -51,24 +51,6 @@ static struct item *list = NULL;
 static void (*logindefs_loader)(void *) = NULL;
 static void *logindefs_loader_data = NULL;
 
-void free_getlogindefs_data(void)
-{
-	struct item *ptr;
-
-	ptr = list;
-	while (ptr) {
-		struct item *tmp = ptr->next;
-
-		free(ptr->path);
-		free(ptr->name);
-		free(ptr->value);
-		free(ptr);
-		ptr = tmp;
-	}
-
-	list = NULL;
-}
-
 static void store(const char *name, const char *value, const char *path)
 {
 	struct item *new = xmalloc(sizeof(struct item));
login-utils/logindefs.h +0 -1
index 064737c6c..0079cd23c 100644
@@ -6,7 +6,6 @@ extern void logindefs_set_loader(void (*loader)(void *data), void *data);
 extern int getlogindefs_bool(const char *name, int dflt);
 extern unsigned long getlogindefs_num(const char *name, long dflt);
 extern const char *getlogindefs_str(const char *name, const char *dflt);
-extern void free_getlogindefs_data(void);
 extern int logindefs_setenv(const char *name, const char *conf, const char *dflt);
 extern int effective_access(const char *path, int mode);
 extern int get_hushlogin_status(struct passwd *pwd, int force_check);
Signature · 1 line
2.15.0
maintainer
#2 lore raw

Re: [PATCH 2/3] logindefs: remove unused function

Quoted 3 lines · Sami Kerola
 login-utils/logindefs.c | 18 ------------------
 login-utils/logindefs.h |  1 -
 2 files changed, 19 deletions(-)

All patches applied except this patch.

I've added free_getlogindefs_data() to su(1) and login(1). It seems like a good idea to deallocate the config file when we only wait for child process.

Thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#3 lore raw

PATCH 3/3 eject: remove list_speeds() #ifdef CDROM_SELECT_SPEED protection

In reply to Sami Kerola

The CDROM_SELECT_SPEED should be available practically everywhere. Where the define is missing an error message about path /proc/sys/dev/cdrom/info cannot be opened is better error than a warnx() about kernel support.

---
 sys-utils/eject.c | 4 ----
 1 file changed, 4 deletions(-)
sys-utils/eject.c +0 -4
index aa90ff72f..a38c5c38c 100644
@@ -548,7 +548,6 @@ static int read_speed(const char *devname)
  */
 static void list_speeds(struct eject_control *ctl)
 {
-#ifdef CDROM_SELECT_SPEED
 	int max_speed, curr_speed = 0;
 
 	select_speed(ctl);
@@ -565,9 +564,6 @@ static void list_speeds(struct eject_control *ctl)
 	}
 
 	printf("\n");
-#else
-	warnx(_("CD-ROM select speed command not supported by this kernel"));
-#endif
 }
 
 /*
Signature · 1 line
2.15.0