cloud-setup/trivial: rename "response_data" variable

We have three implementations of providers, that all do something similar.
Name the variable with the HTTP response GBytes the same everywhere.
This commit is contained in:
Thomas Haller 2021-01-05 10:20:41 +01:00
parent 9afdbb97ea
commit 5fb2f7e717
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 16 additions and 16 deletions

View file

@ -263,7 +263,7 @@ _get_config_ips_prefix_list_cb(GObject *source, GAsyncResult *result, gpointer u
if (line_len == 0) if (line_len == 0)
continue; continue;
/* Truncate the string. It's safe to do, because we own @response_data an it has an /* Truncate the string. It's safe to do, because we own @response an it has an
* extra NULL character after the buffer. */ * extra NULL character after the buffer. */
((char *) line)[line_len] = '\0'; ((char *) line)[line_len] = '\0';
@ -431,7 +431,7 @@ _get_net_ifaces_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
if (line_len == 0) if (line_len == 0)
continue; continue;
/* Truncate the string. It's safe to do, because we own @response_data an it has an /* Truncate the string. It's safe to do, because we own @response an it has an
* extra NULL character after the buffer. */ * extra NULL character after the buffer. */
((char *) line)[line_len] = '\0'; ((char *) line)[line_len] = '\0';

View file

@ -72,11 +72,11 @@ G_DEFINE_TYPE(NMCSProviderEC2, nmcs_provider_ec2, NMCS_TYPE_PROVIDER);
static gboolean static gboolean
_detect_get_meta_data_check_cb(long response_code, _detect_get_meta_data_check_cb(long response_code,
GBytes * response_data, GBytes * response,
gpointer check_user_data, gpointer check_user_data,
GError **error) GError **error)
{ {
return response_code == 200 && nmcs_utils_parse_get_full_line(response_data, "ami-id"); return response_code == 200 && nmcs_utils_parse_get_full_line(response, "ami-id");
} }
static void static void
@ -187,13 +187,13 @@ _get_config_fetch_done_cb(NMHttpClient *http_client,
gboolean is_local_ipv4) gboolean is_local_ipv4)
{ {
GetConfigIfaceData *iface_data; GetConfigIfaceData *iface_data;
const char * hwaddr = NULL; const char * hwaddr = NULL;
gs_unref_bytes GBytes *response_data = NULL; gs_unref_bytes GBytes *response = NULL;
gs_free_error GError *error = NULL; gs_free_error GError *error = NULL;
nm_utils_user_data_unpack(user_data, &iface_data, &hwaddr); nm_utils_user_data_unpack(user_data, &iface_data, &hwaddr);
nm_http_client_poll_get_finish(http_client, result, NULL, &response_data, &error); nm_http_client_poll_get_finish(http_client, result, NULL, &response, &error);
if (!error) { if (!error) {
NMCSProviderGetConfigIfaceData *config_iface_data; NMCSProviderGetConfigIfaceData *config_iface_data;
@ -206,7 +206,7 @@ _get_config_fetch_done_cb(NMHttpClient *http_client,
gs_free const char **s_addrs = NULL; gs_free const char **s_addrs = NULL;
gsize i, len; gsize i, len;
s_addrs = nm_utils_strsplit_set_full(g_bytes_get_data(response_data, NULL), s_addrs = nm_utils_strsplit_set_full(g_bytes_get_data(response, NULL),
"\n", "\n",
NM_UTILS_STRSPLIT_SET_FLAGS_STRSTRIP); NM_UTILS_STRSPLIT_SET_FLAGS_STRSTRIP);
len = NM_PTRARRAY_LEN(s_addrs); len = NM_PTRARRAY_LEN(s_addrs);
@ -225,7 +225,7 @@ _get_config_fetch_done_cb(NMHttpClient *http_client,
} }
} else { } else {
if (nm_utils_parse_inaddr_prefix_bin(AF_INET, if (nm_utils_parse_inaddr_prefix_bin(AF_INET,
g_bytes_get_data(response_data, NULL), g_bytes_get_data(response, NULL),
NULL, NULL,
&tmp_addr, &tmp_addr,
&tmp_prefix)) { &tmp_prefix)) {
@ -413,7 +413,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
static gboolean static gboolean
_get_config_metadata_ready_check(long response_code, _get_config_metadata_ready_check(long response_code,
GBytes * response_data, GBytes * response,
gpointer check_user_data, gpointer check_user_data,
GError **error) GError **error)
{ {
@ -428,12 +428,12 @@ _get_config_metadata_ready_check(long response_code,
const char * c_hwaddr; const char * c_hwaddr;
gssize iface_idx_counter = 0; gssize iface_idx_counter = 0;
if (response_code != 200 || !response_data) { if (response_code != 200 || !response) {
/* we wait longer. */ /* we wait longer. */
return FALSE; return FALSE;
} }
r_data = g_bytes_get_data(response_data, &r_len); r_data = g_bytes_get_data(response, &r_len);
/* NMHttpClient guarantees that there is a trailing NUL after the data. */ /* NMHttpClient guarantees that there is a trailing NUL after the data. */
nm_assert(r_data[r_len] == 0); nm_assert(r_data[r_len] == 0);
@ -444,7 +444,7 @@ _get_config_metadata_ready_check(long response_code,
if (cur_line_len == 0) if (cur_line_len == 0)
continue; continue;
/* Truncate the string. It's safe to do, because we own @response_data an it has an /* Truncate the string. It's safe to do, because we own @response an it has an
* extra NUL character after the buffer. */ * extra NUL character after the buffer. */
((char *) cur_line)[cur_line_len] = '\0'; ((char *) cur_line)[cur_line_len] = '\0';

View file

@ -218,7 +218,7 @@ _get_config_ips_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
while (nm_utils_parse_next_line(&response_str, &response_len, &line, &line_len)) { while (nm_utils_parse_next_line(&response_str, &response_len, &line, &line_len)) {
gint64 fip_index; gint64 fip_index;
/* Truncate the string. It's safe to do, because we own @response_data an it has an /* Truncate the string. It's safe to do, because we own @response an it has an
* extra NUL character after the buffer. */ * extra NUL character after the buffer. */
((char *) line)[line_len] = '\0'; ((char *) line)[line_len] = '\0';
@ -358,7 +358,7 @@ _get_net_ifaces_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
if (line_len == 0) if (line_len == 0)
continue; continue;
/* Truncate the string. It's safe to do, because we own @response_data an it has an /* Truncate the string. It's safe to do, because we own @response an it has an
* extra NUL character after the buffer. */ * extra NUL character after the buffer. */
((char *) line)[line_len] = '\0'; ((char *) line)[line_len] = '\0';
if (line[line_len - 1] == '/') if (line[line_len - 1] == '/')