httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/include apr_buf.h
Date Wed, 12 Jul 2000 22:10:05 GMT
rbb         00/07/12 15:10:03

  Modified:    src/lib/apr/buckets ap_buf.c
               src/lib/apr/include apr_buf.h
  Log:
  Implement very basic versions of ap_bucket_printf and ap_bucket_vprintf
  for read only buckets.  These really should just write directly into the
  bucket, but I am need something that works, and we can correct this later.
  
  Revision  Changes    Path
  1.7       +40 -0     apache-2.0/src/lib/apr/buckets/ap_buf.c
  
  Index: ap_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_buf.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ap_buf.c	2000/07/12 22:00:07	1.6
  +++ ap_buf.c	2000/07/12 22:09:57	1.7
  @@ -317,3 +317,43 @@
       return k;
   }
   
  +APR_EXPORT(int) ap_brigade_printf(ap_bucket_brigade *b, const char *fmt, ...)
  +{
  +    va_list ap;
  +    int res;
  +
  +    va_start(ap, fmt);
  +    res = ap_brigade_vprintf(b, fmt, ap);
  +    va_end(ap);
  +    return res;
  +}
  +
  +APR_EXPORT(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_list va)
  +{
  +    /* THIS IS A HACK.  This needs to be replaced with a function to printf
  +     * directly into a bucket.  I'm being lazy right now.  RBB
  +     */
  +    char buf[4096];
  +    ap_bucket *r;
  +    int res, i;
  +
  +    res = ap_vsnprintf(buf, 4096, fmt, va);
  +
  +    r = ap_bucket_new(AP_BUCKET_rmem);
  +    res = ap_rmem_write(r->data, buf, strlen(buf), &i);
  +
  +    /* This really requires an API.  Basically we are just adding
  +     * a bucket to a bucket list.
  +     */
  +    if (b->tail->bucket == NULL) {
  +        b->tail->bucket = r;
  +    }
  +    else {
  +        b->tail->next = ap_bucket_list_create();
  +        b->tail->next->prev = b->tail;
  +        b->tail = b->tail->next;
  +        b->tail->bucket = r;
  +    }
  +    return res;
  +}
  +
  
  
  
  1.8       +5 -0      apache-2.0/src/lib/apr/include/apr_buf.h
  
  Index: apr_buf.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_buf.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- apr_buf.h	2000/07/12 22:00:08	1.7
  +++ apr_buf.h	2000/07/12 22:09:58	1.8
  @@ -138,6 +138,11 @@
   
   APR_EXPORT(int) ap_brigade_vputstrs(ap_bucket_brigade *b, va_list va);
   
  +APR_EXPORT(int) ap_brigade_printf(ap_bucket_brigade *b, const char *fmt, ...);
  +
  +APR_EXPORT(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_lis
  +t va);
  +
   /*   ******  Bucket List Functions  *****  */
   
   /* create a new bucket_list */
  
  
  

Mime
View raw message