X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fcsl%2Fcontext.h;h=94f6813463f364d252a41d4343cedb32ee084e07;hb=969fea8e7bed82c109685ec3976cf7b0ec514ae9;hp=ce7b0316a124c3ebe4d2fdf84e080e4ac7794f1a;hpb=f92f0f9bcb54167331067b6891ee33e5f27d691c;p=awesomized%2Flibmemcached diff --git a/libmemcached/csl/context.h b/libmemcached/csl/context.h index ce7b0316..94f68134 100644 --- a/libmemcached/csl/context.h +++ b/libmemcached/csl/context.h @@ -37,13 +37,15 @@ #pragma once -#include +#include +#include class Context { public: Context(const char *option_string, size_t option_string_length, memcached_st *memc_arg, memcached_return_t &rc_arg) : + previous_token(END), scanner(NULL), begin(NULL), pos(0), @@ -88,50 +90,22 @@ public: return _is_server; } - const char *set_hostname(const char *str, size_t size) - { - size_t copy_length= (size_t)NI_MAXHOST > size ? size : (size_t)NI_MAXHOST; - memcpy(_hostname, str, copy_length); - _hostname[copy_length]= 0; - - return _hostname; - } + const char *set_hostname(const char *str, size_t size); const char *hostname() { return _hostname; } - void abort(const char *error) - { - if (rc == MEMCACHED_SUCCESS) - rc= MEMCACHED_PARSE_ERROR; - - memcached_string_st *error_string= memcached_string_create(memc, NULL, 1024); - memcached_string_append(error_string, memcached_literal_param("Error occured while parsing: ")); - memcached_string_append(error_string, memcached_string_make_from_cstr(begin)); - memcached_string_append(error_string, memcached_literal_param(" (")); - - if (rc == MEMCACHED_PARSE_ERROR and error) - { - memcached_string_append(error_string, memcached_string_make_from_cstr(error)); - } - else - { - memcached_string_append(error_string, memcached_string_make_from_cstr(memcached_strerror(NULL, rc))); - } - memcached_string_append(error_string, memcached_literal_param(")")); - - memcached_set_error(*memc, rc, MEMCACHED_AT, memcached_string_value(error_string), memcached_string_length(error_string)); - - memcached_string_free(error_string); - } + void abort(const char *, yytokentype, const char *); + void error(const char *, yytokentype, const char* ); ~Context() { destroy_scanner(); } + yytokentype previous_token; void *scanner; const char *buf; const char *begin;