~ubuntu-branches/ubuntu/karmic/memcached/karmic

« back to all changes in this revision

Viewing changes to items.c

  • Committer: Bazaar Package Importer
  • Author(s): Jay Bonci
  • Date: 2005-04-11 11:54:39 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050411115439-89tojj4gpqjvbk34
Tags: 1.1.12-1
* New upstream version
* Updates watchfile so uupdate will work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
 
/* $Id: items.c,v 1.21 2004/03/31 05:01:51 avva Exp $ */
 
2
/* $Id: items.c,v 1.23 2004/09/13 22:31:53 avva Exp $ */
3
3
 
4
4
#include <sys/types.h>
5
5
#include <sys/stat.h>
214
214
    item *it;
215
215
    int len;
216
216
    int shown = 0;
217
 
    char temp[256];
 
217
    char temp[512];
218
218
    
219
219
    if (slabs_clsid > LARGEST_ID) return 0;
220
220
    it = heads[slabs_clsid];
223
223
    if (buffer == 0) return 0;
224
224
    bufcurr = 0;
225
225
 
226
 
    while(1) {
227
 
        if(limit && shown >=limit)
228
 
            break;
229
 
        if (!it)
230
 
            break;
231
 
        sprintf(temp, "ITEM %s [%u b; %lu s]\r\n", ITEM_key(it), it->nbytes - 2, it->time);
232
 
        len = strlen(temp);
233
 
        if (bufcurr + len +5 > memlimit)  /* 5 is END\r\n */
 
226
    while (it && (!limit || shown < limit)) {
 
227
        len = sprintf(temp, "ITEM %s [%u b; %lu s]\r\n", ITEM_key(it), it->nbytes - 2, it->time);
 
228
        if (bufcurr + len + 6 > memlimit)  /* 6 is END\r\n\0 */
234
229
            break;
235
230
        strcpy(buffer + bufcurr, temp);
236
231
        bufcurr+=len;
278
273
    }
279
274
 
280
275
    /* build the histogram */
281
 
    memset(buf, 0, num_buckets * sizeof(int));
 
276
    memset(histogram, 0, num_buckets * sizeof(int));
282
277
    for (i=0; i<LARGEST_ID; i++) {
283
278
        item *iter = heads[i];
284
279
        while (iter) {