summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-09-17 10:31:18 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-09-17 10:31:18 +0300
commitcc68353128ea704bae581811583fe98969e1a0f8 (patch)
treec79a0d5be3d09cbfc3e46d7ca5aff4a9e1262c87 /rpmio
parentc07bda47cff8e854ca220d1d49d9ae28f83006a0 (diff)
downloadrpm-cc68353128ea704bae581811583fe98969e1a0f8.tar.gz
rpm-cc68353128ea704bae581811583fe98969e1a0f8.tar.bz2
rpm-cc68353128ea704bae581811583fe98969e1a0f8.zip
Remove url caching, don't need it...
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/rpmurl.h47
-rw-r--r--rpmio/tdir.c2
-rw-r--r--rpmio/tfts.c2
-rw-r--r--rpmio/tget.c2
-rw-r--r--rpmio/thkp.c2
-rw-r--r--rpmio/tput.c2
-rw-r--r--rpmio/url.c133
7 files changed, 10 insertions, 180 deletions
diff --git a/rpmio/rpmurl.h b/rpmio/rpmurl.h
index 30afdd187..1c768c544 100644
--- a/rpmio/rpmurl.h
+++ b/rpmio/rpmurl.h
@@ -29,7 +29,6 @@ typedef struct urlinfo_s * urlinfo;
* URL control structure.
*/
struct urlinfo_s {
-int nrefs; /*!< no. of references */
const char * url; /*!< copy of original url */
const char * scheme; /*!< URI scheme. */
const char * user; /*!< URI user. */
@@ -49,58 +48,20 @@ int nrefs; /*!< no. of references */
extern "C" {
#endif
-extern int _url_count; /*!< No. of cached URL's. */
-
-extern urlinfo * _url_cache; /*!< URL cache. */
-
-extern int _url_iobuf_size; /*!< Initial size of URL I/O buffer. */
-#define RPMURL_IOBUF_SIZE 4096
-
extern int _url_debug; /*!< URL debugging? */
-#define RPMURL_DEBUG_IO 0x40000000
-#define RPMURL_DEBUG_REFS 0x20000000
-
/**
- * Create a URL control structure instance.
- * @param msg debugging identifier (unused)
+ * Create a URL info structure instance.
* @return new instance
*/
-urlinfo urlNew(const char * msg) ;
-
-/** @todo Remove debugging entry from the ABI. */
-urlinfo XurlNew(const char * msg, const char * file, unsigned line) ;
-#define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__)
-
-/**
- * Reference a URL control structure instance.
- * @param u URL control structure
- * @param msg debugging identifier (unused)
- * @return referenced instance
- */
-urlinfo urlLink(urlinfo u, const char * msg);
-
-/** @todo Remove debugging entry from the ABI. */
-urlinfo XurlLink(urlinfo u, const char * msg, const char * file, unsigned line);
-#define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__)
+urlinfo urlNew(void);
/**
- * Dereference a URL control structure instance.
+ * Free a URL info structure instance.
* @param u URL control structure
- * @param msg debugging identifier (unused)
* @return dereferenced instance (NULL if freed)
*/
-urlinfo urlFree( urlinfo u, const char * msg);
-
-/** @todo Remove debugging entry from the ABI. */
-urlinfo XurlFree( urlinfo u, const char * msg,
- const char * file, unsigned line);
-#define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__)
-
-/**
- * Free cached URL control structures.
- */
-void urlFreeCache(void);
+urlinfo urlFree(urlinfo u);
/**
* Return type of URL.
diff --git a/rpmio/tdir.c b/rpmio/tdir.c
index d1b34591c..640aeb321 100644
--- a/rpmio/tdir.c
+++ b/rpmio/tdir.c
@@ -73,7 +73,5 @@ main(int argc, const char *argv[])
printDir(ftppath);
printDir(httppath);
-urlFreeCache();
-
return 0;
}
diff --git a/rpmio/tfts.c b/rpmio/tfts.c
index d89cafe7a..eee701430 100644
--- a/rpmio/tfts.c
+++ b/rpmio/tfts.c
@@ -168,7 +168,5 @@ main(int argc, const char *argv[])
ftsWalk(httpspath);
#endif
-urlFreeCache();
-
return 0;
}
diff --git a/rpmio/tget.c b/rpmio/tget.c
index ab7fbd603..60231b71f 100644
--- a/rpmio/tget.c
+++ b/rpmio/tget.c
@@ -85,7 +85,5 @@ main(int argc, const char *argv[])
readFile(httpspath);
#endif
-urlFreeCache();
-
return 0;
}
diff --git a/rpmio/thkp.c b/rpmio/thkp.c
index 267604cd7..0f8576379 100644
--- a/rpmio/thkp.c
+++ b/rpmio/thkp.c
@@ -121,7 +121,5 @@ main(int argc, const char *argv[])
readKeys(hkppath);
-urlFreeCache();
-
return 0;
}
diff --git a/rpmio/tput.c b/rpmio/tput.c
index fbbe74bea..ed292a9f9 100644
--- a/rpmio/tput.c
+++ b/rpmio/tput.c
@@ -135,7 +135,5 @@ main(int argc, const char *argv[])
doFile(httpspath);
#endif
-urlFreeCache();
-
return 0;
}
diff --git a/rpmio/url.c b/rpmio/url.c
index 4354dc974..8f5e8583a 100644
--- a/rpmio/url.c
+++ b/rpmio/url.c
@@ -27,25 +27,10 @@
/**
*/
-int _url_iobuf_size = RPMURL_IOBUF_SIZE;
-
-/**
- */
int _url_debug = 0;
#define URLDBG(_f, _m, _x) if ((_url_debug | (_f)) & (_m)) fprintf _x
-#define URLDBGIO(_f, _x) URLDBG((_f), RPMURL_DEBUG_IO, _x)
-#define URLDBGREFS(_f, _x) URLDBG((_f), RPMURL_DEBUG_REFS, _x)
-
-/**
- */
-urlinfo *_url_cache = NULL;
-
-/**
- */
-int _url_count = 0;
-
/**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param p memory to free
@@ -58,15 +43,7 @@ _free(const void * p)
return NULL;
}
-urlinfo XurlLink(urlinfo u, const char *msg, const char *file, unsigned line)
-{
- URLSANE(u);
- u->nrefs++;
-URLDBGREFS(0, (stderr, "--> url %p ++ %d %s at %s:%u\n", u, u->nrefs, msg, file, line));
- return u;
-}
-
-urlinfo XurlNew(const char *msg, const char *file, unsigned line)
+urlinfo urlNew()
{
urlinfo u;
if ((u = xmalloc(sizeof(*u))) == NULL)
@@ -75,17 +52,13 @@ urlinfo XurlNew(const char *msg, const char *file, unsigned line)
u->proxyp = -1;
u->port = -1;
u->urltype = URL_IS_UNKNOWN;
- u->nrefs = 0;
u->magic = URLMAGIC;
- return XurlLink(u, msg, file, line);
+ return u;
}
-urlinfo XurlFree(urlinfo u, const char *msg, const char *file, unsigned line)
+urlinfo urlFree(urlinfo u)
{
URLSANE(u);
-URLDBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file, line));
- if (--u->nrefs > 0)
- return u;
u->url = _free(u->url);
u->scheme = _free((void *)u->scheme);
u->user = _free((void *)u->user);
@@ -99,98 +72,6 @@ URLDBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file,
return NULL;
}
-void urlFreeCache(void)
-{
- if (_url_cache) {
- int i;
- for (i = 0; i < _url_count; i++) {
- if (_url_cache[i] == NULL) continue;
- _url_cache[i] = urlFree(_url_cache[i], "_url_cache");
- if (_url_cache[i])
- fprintf(stderr,
- _("warning: _url_cache[%d] %p nrefs(%d) != 1 (%s %s)\n"),
- i, _url_cache[i], _url_cache[i]->nrefs,
- (_url_cache[i]->host ? _url_cache[i]->host : ""),
- (_url_cache[i]->scheme ? _url_cache[i]->scheme : ""));
- }
- }
- _url_cache = _free(_url_cache);
- _url_count = 0;
-}
-
-static int urlStrcmp(const char * str1, const char * str2)
-{
- if (str1)
- if (str2)
- return strcmp(str1, str2);
- if (str1 != str2)
- return -1;
- return 0;
-}
-
-static void urlFind(urlinfo * uret, int mustAsk)
-{
- urlinfo u;
- int ucx;
- int i = 0;
-
- if (uret == NULL)
- return;
-
- u = *uret;
- URLSANE(u);
-
- ucx = -1;
- for (i = 0; i < _url_count; i++) {
- urlinfo ou = NULL;
- if (_url_cache == NULL || (ou = _url_cache[i]) == NULL) {
- if (ucx < 0)
- ucx = i;
- continue;
- }
-
- /* Check for cache-miss condition. A cache miss is
- * a) both items are not NULL and don't compare.
- * b) either of the items is not NULL.
- */
- if (urlStrcmp(u->scheme, ou->scheme))
- continue;
- if (urlStrcmp(u->host, ou->host))
- continue;
- if (urlStrcmp(u->user, ou->user))
- continue;
- if (urlStrcmp(u->portstr, ou->portstr))
- continue;
- break; /* Found item in cache */
- }
-
- if (i == _url_count) {
- if (ucx < 0) {
- ucx = _url_count++;
- _url_cache = xrealloc(_url_cache, sizeof(*_url_cache) * _url_count);
- }
- if (_url_cache) /* XXX always true */
- _url_cache[ucx] = urlLink(u, "_url_cache (miss)");
- u = urlFree(u, "urlSplit (urlFind miss)");
- } else {
- ucx = i;
- u = urlFree(u, "urlSplit (urlFind hit)");
- }
-
- /* This URL is now cached. */
-
- if (_url_cache) /* XXX always true */
- u = urlLink(_url_cache[ucx], "_url_cache");
- *uret = u;
- u = urlFree(u, "_url_cache (urlFind)");
-
- /* Zap proxy host and port in case they have been reset */
- u->proxyp = -1;
- u->proxyh = _free(u->proxyh);
-
- return;
-}
-
/**
*/
static struct urlstring {
@@ -281,11 +162,11 @@ int urlSplit(const char * url, urlinfo *uret)
if (uret == NULL)
return -1;
- if ((u = urlNew("urlSplit")) == NULL)
+ if ((u = urlNew()) == NULL)
return -1;
if ((se = s = myurl = xstrdup(url)) == NULL) {
- u = urlFree(u, "urlSplit (error #1)");
+ u = urlFree(u);
return -1;
}
@@ -342,7 +223,7 @@ int urlSplit(const char * url, urlinfo *uret)
if (!(end && *end == '\0')) {
rpmMessage(RPMMESS_ERROR, _("url port must be a number\n"));
myurl = _free(myurl);
- u = urlFree(u, "urlSplit (error #3)");
+ u = urlFree(u);
return -1;
}
}
@@ -368,8 +249,6 @@ int urlSplit(const char * url, urlinfo *uret)
myurl = _free(myurl);
if (uret) {
*uret = u;
-/* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
- urlFind(uret, 0);
}
return 0;
}