Skip to content

Commit

Permalink
[Edgecore][as9516-32d] Parsing from the first value of curl response …
Browse files Browse the repository at this point in the history
…data for curl parser

Parsing from the first value of curl response data for curl parser

Signed-off-by: Willy Liu <[email protected]>
  • Loading branch information
WillyLiu-EC committed May 30, 2023
1 parent c99dedc commit 95be6f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ static void ps_call_back(void *p)
AIM_LOG_ERROR("Failed CURL response data.\n");
return;
}

i = data_loc_start - ptr;
/* Start to parse from the first value, ignore '[' */
i = data_loc_start - ptr + 1;
while (ptr[i] && ptr[i] != ']')
{
j = 0;
Expand All @@ -180,11 +180,7 @@ static void ps_call_back(void *p)
/* There are three string - model name/serial/model ver */
if ((k < curl_data_loc_psu_model_name) || (k > curl_data_loc_psu_model_ver))
{
/* To avoid to get error char in first item */
if (k == 0)
ps[k] = atoi(str+1);
else
ps[k] = atoi(str);
ps[k] = atoi(str);
}

k++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ static void ps_call_back(void *p)
AIM_LOG_ERROR("Failed CURL response data.\n");
return;
}

i = data_loc_start - ptr;
/* Start to parse from the first value, ignore '[' */
i = data_loc_start - ptr + 1;
while (ptr[i] && ptr[i] != ']')
{
j = 0;
Expand All @@ -125,13 +125,9 @@ static void ps_call_back(void *p)
/* There are three string - model name/serial/model ver */
if ((k < curl_data_loc_psu_model_name) || (k > curl_data_loc_psu_model_ver))
{
/* To avoid to get error char in first item */
if (k == 0)
ps[k] = atoi(str+1);
else
ps[k] = atoi(str);
}
else
ps[k] = atoi(str);
}
else
{
switch (k)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ void tmp_call_back(void *p)
AIM_LOG_ERROR("Failed CURL response data.\n");
return;
}

i = data_loc_start - ptr;
/* Start to parse from the first value, ignore '[' */
i = data_loc_start - ptr + 1;
while (ptr[i] && ptr[i] != ']')
{
j = 0;
Expand All @@ -139,10 +139,7 @@ void tmp_call_back(void *p)

if (k < curl_data_thermal_num)
{
if (k == 0)
tmp[k] = atoi(str+1);
else
tmp[k] = atoi(str);
tmp[k] = atoi(str);
k++;
}

Expand Down

0 comments on commit 95be6f8

Please sign in to comment.