move ngx_http_string_piece_to_pool_string out of anonymous namespace

This commit is contained in:
Jeff Kaufman
2012-11-14 15:19:09 -05:00
parent 16a9ed56bc
commit a85de8cb68
+13 -13
View File
@@ -64,6 +64,19 @@ ngx_http_pagespeed_str_to_string_piece(ngx_str_t s) {
return StringPiece(reinterpret_cast<char*>(s.data), s.len);
}
char*
ngx_http_string_piece_to_pool_string(ngx_pool_t* pool, StringPiece sp) {
// Need space for the final null.
ngx_uint_t buffer_size = sp.size() + 1;
char* s = static_cast<char*>(ngx_palloc(pool, buffer_size));
if (s == NULL) {
return NULL;
}
sp.copy(s, buffer_size /* max to copy */);
s[buffer_size-1] = '\0'; // Null terminate it.
return s;
}
typedef struct {
net_instaweb::NgxRewriteDriverFactory* driver_factory;
net_instaweb::NgxServerContext* server_context;
@@ -156,19 +169,6 @@ ngx_command_t ngx_http_pagespeed_commands[] = {
ngx_null_command
};
char*
ngx_http_string_piece_to_pool_string(ngx_pool_t* pool, StringPiece sp) {
// Need space for the final null.
ngx_uint_t buffer_size = sp.size() + 1;
char* s = static_cast<char*>(ngx_palloc(pool, buffer_size));
if (s == NULL) {
return NULL;
}
sp.copy(s, buffer_size /* max to copy */);
s[buffer_size-1] = '\0'; // Null terminate it.
return s;
}
#define NGX_PAGESPEED_MAX_ARGS 10
char*
ngx_http_pagespeed_configure(ngx_conf_t* cf, ngx_command_t* cmd, void* conf) {