return -1;
}
-bool HTTPInput::parse_response(const std::string &request)
+bool HTTPInput::parse_response(const string &request)
{
vector<string> lines = split_lines(response);
if (lines.empty()) {
return true;
}
-Input *create_input(const std::string &url)
+Input *create_input(const string &url)
{
string protocol, user, host, port, path;
if (!parse_url(url, &protocol, &user, &host, &port, &path)) {
#define SYSLOG_FAKE_FILE (static_cast<FILE *>(NULL))
bool logging_started = false;
-std::vector<FILE *> log_destinations;
+vector<FILE *> log_destinations;
-void add_log_destination_file(const std::string &filename)
+void add_log_destination_file(const string &filename)
{
FILE *fp = fopen(filename.c_str(), "a");
if (fp == NULL) {
start_logging();
}
-bool dry_run_config(const std::string &argv0, const std::string &config_filename)
+bool dry_run_config(const string &argv0, const string &config_filename)
{
char *argv0_copy = strdup(argv0.c_str());
char *config_filename_copy = strdup(config_filename.c_str());
// If this client doesn't exist anymore, just ignore it
// (it was deleted earlier).
- std::map<int, Client>::iterator client_it = clients.find(connect_time_and_fd.second);
+ map<int, Client>::iterator client_it = clients.find(connect_time_and_fd.second);
if (client_it == clients.end()) {
clients_ordered_by_connect_time.pop();
continue;
}
}
-int Server::lookup_stream_by_url(const std::string &url) const
+int Server::lookup_stream_by_url(const string &url) const
{
map<string, int>::const_iterator url_it = url_map.find(url);
if (url_it == url_map.end()) {
Stream *stream = client->stream;
if (client->stream_pos == size_t(-2)) {
// Start sending from the beginning of the backlog.
- client->stream_pos = std::min<size_t>(
+ client->stream_pos = min<size_t>(
stream->bytes_received - stream->backlog_size,
0);
client->state = Client::SENDING_DATA;
servers[clients_added++ % num_servers].add_client_from_serialized(client);
}
-int ServerPool::lookup_stream_by_url(const std::string &url) const
+int ServerPool::lookup_stream_by_url(const string &url) const
{
assert(servers != NULL);
return servers[0].lookup_stream_by_url(url);
extern ServerPool *servers;
-StatsThread::StatsThread(const std::string &stats_file, int stats_interval)
+StatsThread::StatsThread(const string &stats_file, int stats_interval)
: stats_file(stats_file),
stats_interval(stats_interval)
{
vector<iovec> collect_iovecs(const vector<Stream::DataElement> &data, size_t bytes_wanted)
{
vector<iovec> ret;
- size_t max_iovecs = std::min<size_t>(data.size(), IOV_MAX);
+ size_t max_iovecs = min<size_t>(data.size(), IOV_MAX);
for (size_t i = 0; i < max_iovecs && bytes_wanted > 0; ++i) {
if (data[i].data.iov_len <= bytes_wanted) {
// Consume the entire iovec.
void Stream::process_queued_data()
{
- std::vector<DataElement> queued_data_copy;
+ vector<DataElement> queued_data_copy;
// Hold the lock for as short as possible, since add_data_raw() can possibly
// write to disk, which might disturb the input thread.
using namespace std;
-int make_tempfile(const std::string &contents)
+int make_tempfile(const string &contents)
{
int fd = open("/tmp", O_RDWR | O_TMPFILE, 0600);
if (fd == -1) {
return fd;
}
-bool read_tempfile_and_close(int fd, std::string *contents)
+bool read_tempfile_and_close(int fd, string *contents)
{
bool ok = read_tempfile(fd, contents);
safe_close(fd); // Implicitly deletes the file.
return ok;
}
-bool read_tempfile(int fd, std::string *contents)
+bool read_tempfile(int fd, string *contents)
{
ssize_t ret, has_read;