RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [email protected] Module: rpm Date: 09-Jul-2009 22:01:44 Branch: HEAD Handle: 2009070920014400 Modified files: rpm/rpmio rpmdav.c Log: - rpmdav: put a lowater check on html buffer refills to minimize overhead. Summary: Revision Changes Path 2.104 +8 -5 rpm/rpmio/rpmdav.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/rpmdav.c ============================================================================ $ cvs diff -u -r2.103 -r2.104 rpmdav.c --- rpm/rpmio/rpmdav.c 9 Jul 2009 17:33:10 -0000 2.103 +++ rpm/rpmio/rpmdav.c 9 Jul 2009 20:01:44 -0000 2.104 @@ -155,7 +155,7 @@ ne_lockstore_destroy(u->lockstore); u->lockstore = NULL; u->info.status = 0; - ne_sock_exit(); + ne_sock_exit(); /* XXX refcounted. oneshot? */ break; } } @@ -554,7 +554,7 @@ rc = ((_dav_debug < 0) ? NE_DBG_HTTP : 0); ne_debug_init(stderr, rc); /* XXX oneshot? */ /*...@=noeffect@*/ - rc = ne_sock_init(); /* XXX oneshot? */ + rc = ne_sock_init(); /* XXX refcounted. oneshot? */ u->lockstore = ne_lockstore_create(); /* XXX oneshot? */ @@ -1284,8 +1284,9 @@ while (h > f && h[-1] != '"') h--; /* [h:he) contains the href. */ +assert(he > h); nh = (size_t)(he - h); - href = t = xmalloc(nh + 1 + 1); + href = t = xmalloc(nh + 1 + 1); /* XXX +1 for trailing '/' */ while (h < he) { char c = *h++; switch (c) { @@ -1307,6 +1308,7 @@ case URL_IS_UNKNOWN: default: /* XXX verify "same tree" as root URI. */ +assert(nh > 0); if (href[nh-1] == '/') { st_mode = S_IFDIR | 0755; href[nh-1] = '\0'; @@ -1374,12 +1376,13 @@ html->nb -= offsets[1]; } else { size_t nb = html->nb; - if (nr > 0) nb -= 128; /* XXX overlap a bit if filling. */ + if (nr > 0) nb -= 256; /* XXX overlap a bit if filling. */ html->b += nb; html->nb -= nb; } - if (nr > 0) + /* XXX Refill iff lowater reaches nbuf/4 (~2kB) */ + if (nr > 0 && html->nb < (html->nbuf/4)) nr = htmlFill(html); } @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
