fix -Wunused-result warnings when calling asprintf()

Fix these warnings:

papertrail_proc.hh: In constructor ‘papertrail_proc::papertrail_proc(const string&, time_t, time_t)’:
papertrail_proc.hh:107:36: warning: ignoring return value of ‘int asprintf(char**, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
                  this->ptp_api_key);
                                    ^
papertrail_proc.hh: In member function ‘void papertrail_proc::set_url()’:
papertrail_proc.hh:146:47: warning: ignoring return value of ‘int asprintf(char**, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
                  this->ptp_quoted_search.in());
This commit is contained in:
Adam Spiers 2016-11-20 12:21:12 +00:00
parent 43ac6366cb
commit 7988200701

View File

@ -102,9 +102,11 @@ public:
this->ptp_search.c_str(), this->ptp_search.c_str(),
this->ptp_search.size()); this->ptp_search.size());
asprintf(this->ptp_token_header.out(), if (asprintf(this->ptp_token_header.out(),
"X-Papertrail-Token: %s", "X-Papertrail-Token: %s",
this->ptp_api_key); this->ptp_api_key) == -1) {
perror("Failed to allocate X-Papertrail-Token string");
}
this->ptp_header_list = curl_slist_append(this->ptp_header_list, this->ptp_header_list = curl_slist_append(this->ptp_header_list,
this->ptp_token_header.in()); this->ptp_token_header.in());
@ -140,10 +142,12 @@ public:
"max_time=%ld&", "max_time=%ld&",
this->ptp_max_time); this->ptp_max_time);
} }
asprintf(this->ptp_url.out(), if (asprintf(this->ptp_url.out(),
"%sq=%s", "%sq=%s",
base_url, base_url,
this->ptp_quoted_search.in()); this->ptp_quoted_search.in()) == -1) {
perror("Failed to allocate ptp_url");
}
curl_easy_setopt(this->cr_handle, CURLOPT_URL, this->ptp_url.in()); curl_easy_setopt(this->cr_handle, CURLOPT_URL, this->ptp_url.in());
}; };