From e85b3b7993d8e752aa1f409cc4a69f1f63620411 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 8 Feb 2013 21:55:12 +0100 Subject: [PATCH] dlhist.c: use file_cmp from utils.h instead of static path_cmp. --- Makefile | 2 +- dlhist.c | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 6241d7e..28f197d 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ install : $(PROGRAMS) cp $^ $(HOME)/bin/ dlight : dlight.o buffer.o env.o http.o rss.o lockfile.o filter.o cconf.o \ - proc-cache.o dlhist.o hash.o xalloc.o error.o + proc-cache.o dlhist.o hash.o xalloc.o error.o utils.o dlight-compile : compile.o buffer.o env.o lockfile.o filter.o cconf.o \ error.o dlight-read-config : read-config.o buffer.o env.o cconf.o error.o diff --git a/dlhist.c b/dlhist.c index 5bcac73..cbfa4da 100644 --- a/dlhist.c +++ b/dlhist.c @@ -29,6 +29,7 @@ #include "env.h" #include "error.h" #include "lockfile.h" +#include "utils.h" #include "dlhist.h" /* \195 D L H */ @@ -291,16 +292,6 @@ error: return ret; } -static int path_cmp(const char *a, const char *b) { - - struct stat sa, sb; - - if (stat(a, &sa) < 0 || stat(b, &sb) < 0) - return 0; - return sa.st_dev == sb.st_dev && - sa.st_ino == sb.st_ino; -} - int dlhist_lookup(const char *title, const char *dest) { struct hash_entry *he; @@ -313,7 +304,7 @@ int dlhist_lookup(const char *title, const char *dest) { int i; for(i=0; i < he->dest_nr; i++) { - if (path_cmp(he->dest[i].path, dest)) + if (file_cmp(he->dest[i].path, dest)) return 1; } }