Move obsolete evbuffer function into include/event2/buffer_compat.h

svn:r1043
This commit is contained in:
Nick Mathewson 2009-01-23 01:35:57 +00:00
parent c735f2b45a
commit ec2f4cbc09
5 changed files with 39 additions and 9 deletions

View File

@ -67,6 +67,7 @@
#include "event2/event.h"
#include "event2/buffer.h"
#include "event2/buffer_compat.h"
#include "config.h"
#include "log-internal.h"
#include "mm-internal.h"
@ -132,7 +133,7 @@ evbuffer_invoke_callbacks(struct evbuffer *buffer, size_t old_size)
static void
evbuffer_remove_all_callbacks(struct evbuffer *buffer)
{
struct evbuffer_cb_entry *cbent, *next;
struct evbuffer_cb_entry *cbent;
while ((cbent = TAILQ_FIRST(&buffer->callbacks))) {
TAILQ_REMOVE(&buffer->callbacks, cbent, next);
mm_free(cbent);

View File

@ -51,6 +51,7 @@
#include "event2/util.h"
#include "event2/bufferevent.h"
#include "event2/buffer.h"
#include "event2/buffer_compat.h"
#include "event2/bufferevent_struct.h"
#include "event2/event.h"
#include "log-internal.h"

View File

@ -189,6 +189,7 @@ typedef unsigned short u_short;
#include <event2/event.h>
#include <event2/event_compat.h>
#include <event2/buffer.h>
#include <event2/buffer_compat.h>
#include <event2/bufferevent.h>
#include <event2/bufferevent_struct.h>
#include <event2/tag.h>

View File

@ -219,14 +219,6 @@ enum evbuffer_eol_style {
char *evbuffer_readln(struct evbuffer *buffer, size_t *n_read_out,
enum evbuffer_eol_style eol_style);
/**
Obsolete alias for evbuffer_readln(buffer, NULL, EOL_STYLE_ANY).
@param buffer the evbuffer to read from
@return pointer to a single line, or NULL if an error occurred
*/
char *evbuffer_readline(struct evbuffer *buffer);
/**
Move data from one evbuffer into another evbuffer.

View File

@ -0,0 +1,35 @@
#ifndef _EVENT2_BUFFER_COMPAT_H_
#define _EVENT2_BUFFER_COMPAT_H_
/** @file buffer_compat.h
Obsolete and deprecated versions of the functions in buffer.h: provided
only for backward compatibility.
*/
/**
Obsolete alias for evbuffer_readln(buffer, NULL, EOL_STYLE_ANY).
@param buffer the evbuffer to read from
@return pointer to a single line, or NULL if an error occurred
*/
char *evbuffer_readline(struct evbuffer *buffer);
/**
Replace all callbacks on an evbuffer with a single new callback, or
remove them.
Subsequent calls to evbuffer_setcb() replace callbacks set by previous
calls. Setting the callback to NULL removes any previously set callback.
@param buffer the evbuffer to be monitored
@param cb the callback function to invoke when the evbuffer is modified,
or NULL to remove all callbacks.
@param cbarg an argument to be provided to the callback function
*/
void evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
#endif