~ubuntu-branches/ubuntu/trusty/serf/trusty-security

« back to all changes in this revision

Viewing changes to buckets/simple_buckets.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter Samuelson
  • Date: 2011-06-27 18:09:28 UTC
  • mfrom: (1.2.5 upstream)
  • mto: (3.3.1 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20110627180928-ybwzd3hmx82nu3ir
Tags: 1.0.0~0+svn1514-1
* New upstream snapshot.
  - patches/abi-0.x: Remove as obsolete.
  - patches/kqueue: Forward-port.
  - Bump ABI: libserf0.7{,-dbg} -> libserf1{,-dbg}
  - patches/ip6-localhost: New patch: temporary (I hope) workaround for
    IPv4 / IPv6 confusion in testsuite.
* Implement Multi-Arch: same.
* libserf-dev Conflicts: libserf-0-0-dev, not Breaks.  Thanks, lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    serf_simple_freefunc_t freefunc;
28
28
    void *baton;
29
29
 
30
 
    apr_size_t original_len;
31
30
} simple_context_t;
32
31
 
33
32
 
46
45
    simple_context_t *ctx;
47
46
 
48
47
    ctx = serf_bucket_mem_alloc(allocator, sizeof(*ctx));
49
 
    ctx->current = data;
 
48
    ctx->original = ctx->current = data;
50
49
    ctx->remaining = len;
51
 
    ctx->original = NULL;
52
 
    ctx->original_len = -1;
53
50
    ctx->freefunc = freefunc;
54
51
    ctx->baton = freefunc_baton;
55
52
 
132
129
    serf_default_destroy_and_data(bucket);
133
130
}
134
131
 
135
 
static apr_status_t serf_simple_snapshot(serf_bucket_t *bucket)
136
 
{
137
 
    simple_context_t *ctx = bucket->data;
138
 
 
139
 
    ctx->original = ctx->current;
140
 
    ctx->original_len = ctx->remaining;
141
 
 
142
 
    return APR_SUCCESS;
143
 
}
144
 
 
145
 
static apr_status_t serf_simple_restore_snapshot(serf_bucket_t *bucket)
146
 
{
147
 
    simple_context_t *ctx = bucket->data;
148
 
 
149
 
    ctx->current = ctx->original;
150
 
    ctx->remaining = ctx->original_len;
151
 
    ctx->original = NULL;
152
 
    ctx->original_len = -1;
153
 
 
154
 
    return APR_SUCCESS;
155
 
}
156
 
 
157
 
static int serf_simple_is_snapshot_set(serf_bucket_t *bucket)
158
 
{
159
 
    simple_context_t *ctx = bucket->data;
160
 
 
161
 
    return ctx->original != NULL;  
162
 
}
163
132
 
164
133
const serf_bucket_type_t serf_bucket_type_simple = {
165
134
    "SIMPLE",
170
139
    serf_default_read_bucket,
171
140
    serf_simple_peek,
172
141
    serf_simple_destroy,
173
 
    serf_simple_snapshot,
174
 
    serf_simple_restore_snapshot,
175
 
    serf_simple_is_snapshot_set,
176
142
};