Commit fd6326c2 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

utils.c: Remove unused functions stroflen, feh_get_tmp_dir, feh_get_user_name

parent 39be7968
Loading
Loading
Loading
Loading
+0 −44
Original line number Diff line number Diff line
@@ -27,9 +27,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "debug.h"
#include "options.h"

static char *feh_user_name = NULL;
static char *feh_tmp_dir = NULL;

/* eprintf: print error message and exit */
void eprintf(char *fmt, ...)
{
@@ -146,18 +143,6 @@ char *estrjoin(const char *separator, ...)
	return string;
}

char *stroflen(char c, int l)
{
	static char buf[1024];
	int i = 0;

	buf[0] = '\0';
	while (l--)
		buf[i++] = c;
	buf[i] = '\0';
	return buf;
}

/* free the result please */
char *feh_unique_filename(char *path, char *basename)
{
@@ -205,32 +190,3 @@ char *ereadfile(char *path)

	return estrdup(buffer);
}

char *feh_get_tmp_dir(void)
{
	char *tmp;
	if (feh_tmp_dir)
		return feh_tmp_dir;
	tmp = getenv("TMPDIR");
	if (!tmp)
		tmp = getenv("TMP");
	if (!tmp)
		tmp = getenv("TEMP");
	if (!tmp)
		tmp = "/tmp";
	feh_tmp_dir = estrdup(tmp);
	return feh_tmp_dir;
}

char *feh_get_user_name(void)
{
	struct passwd *pw = NULL;

	if (feh_user_name)
		return feh_user_name;
	setpwent();
	pw = getpwuid(getuid());
	endpwent();
	feh_user_name = estrdup(pw->pw_name);
	return feh_user_name;
}
+0 −3
Original line number Diff line number Diff line
@@ -36,11 +36,8 @@ char *_estrdup(char *s);
void *_emalloc(size_t n);
void *_erealloc(void *ptr, size_t n);
char *estrjoin(const char *separator, ...);
char *stroflen(char, int);
char *feh_unique_filename(char *path, char *basename);
char *ereadfile(char *path);
char *feh_get_tmp_dir(void);
char *feh_get_user_name(void);

#define ESTRAPPEND(a,b) \
  {\