You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Igor Galić <i....@brainsware.org> on 2013/04/25 01:44:32 UTC

Re: git commit: TS-1851: Remove HostDBInfo constructor so it becomes a POD


----- Original Message -----
> Updated Branches:
>   refs/heads/master bb2fcaad3 -> 2915206c7
> 
> 
> TS-1851: Remove HostDBInfo constructor so it becomes a POD
> 
> Somewhere down the line HostDBInfo grew enough constructor complexity
> that it became a non-POD type. The allocation treats it like a POD
> type, so we should make sure that the compiler agrees.
> 
> Rename HostDBRoundRobin::n to HostDBRoundRobin::rrcount. Remove
> unused HostDBInfo::set_from
[snip]
> Commit: 2915206c73f08dcb9d262dfa0f19967f20eaabdf
> Parents: bb2fcaa
[snip]
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2915206c/iocore/hostdb/HostDB.cc
> ----------------------------------------------------------------------
> diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
> index 52075d6..6221885 100644
> --- a/iocore/hostdb/HostDB.cc
> +++ b/iocore/hostdb/HostDB.cc
[snip]
> @@ -2233,7 +2237,7 @@ HostDBInfo::rr()
>  
>    HostDBRoundRobin *r = (HostDBRoundRobin *)
>    hostDB.ptr(&app.rr.offset, hostDB.ptr_to_partition((char *)
>    this));
>  
> -  if (r && (r->n > HOST_DB_MAX_ROUND_ROBIN_INFO || r->n <= 0 ||
> r->good > HOST_DB_MAX_ROUND_ROBIN_INFO || r->good <= 0)) {
> +  if (r && (r->rrcount > HOST_DB_MAX_ROUND_ROBIN_INFO || r->rrcount
> <= 0 || r->good > HOST_DB_MAX_ROUND_ROBIN_INFO || r->good <= 0)) {
>      ink_assert(!"bad round-robin");
>      return NULL;
>    }
> @@ -2359,12 +2363,12 @@ struct ShowHostDB: public ShowCont
>          HostDBRoundRobin *rr_data = r->rr();
>          if (rr_data) {
>            CHECK_SHOW(show("<table border=1>\n"));
> -          CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n",
> "Total", rr_data->n));
> +          CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n",
> "Total", rr_data->rrcount));
>            CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n",
>            "Good", rr_data->good));
>            CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n",
>            "Current", rr_data->current));
>            CHECK_SHOW(show("</table>\n"));
>  
> -          for (int i = 0; i < rr_data->n; i++)
> +          for (int i = 0; i < rr_data->rrcount; i++)
>              showOne(&rr_data->info[i], true, event, e);
>          }
>        }


This code (ugly mix of HTML and C) is surrounded by #ifdef NON_MODULAR
which is #defined in lib/ts/ink_config.h if TS_HAS_STANDALONE_IOCORE 


-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE

Re: git commit: TS-1851: Remove HostDBInfo constructor so it becomes a POD

Posted by James Peach <jp...@apache.org>.
On Apr 24, 2013, at 4:44 PM, Igor Galić <i....@brainsware.org> wrote:

> 
> 
> ----- Original Message -----
>> Updated Branches:
>>  refs/heads/master bb2fcaad3 -> 2915206c7
>> 
>> 
>> TS-1851: Remove HostDBInfo constructor so it becomes a POD
>> 
>> Somewhere down the line HostDBInfo grew enough constructor complexity
>> that it became a non-POD type. The allocation treats it like a POD
>> type, so we should make sure that the compiler agrees.
>> 
>> Rename HostDBRoundRobin::n to HostDBRoundRobin::rrcount. Remove
>> unused HostDBInfo::set_from
> [snip]
>> Commit: 2915206c73f08dcb9d262dfa0f19967f20eaabdf
>> Parents: bb2fcaa
> [snip]
>> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2915206c/iocore/hostdb/HostDB.cc
>> ----------------------------------------------------------------------
>> diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
>> index 52075d6..6221885 100644
>> --- a/iocore/hostdb/HostDB.cc
>> +++ b/iocore/hostdb/HostDB.cc
> [snip]
>> @@ -2233,7 +2237,7 @@ HostDBInfo::rr()
>> 
>>   HostDBRoundRobin *r = (HostDBRoundRobin *)
>>   hostDB.ptr(&app.rr.offset, hostDB.ptr_to_partition((char *)
>>   this));
>> 
>> -  if (r && (r->n > HOST_DB_MAX_ROUND_ROBIN_INFO || r->n <= 0 ||
>> r->good > HOST_DB_MAX_ROUND_ROBIN_INFO || r->good <= 0)) {
>> +  if (r && (r->rrcount > HOST_DB_MAX_ROUND_ROBIN_INFO || r->rrcount
>> <= 0 || r->good > HOST_DB_MAX_ROUND_ROBIN_INFO || r->good <= 0)) {
>>     ink_assert(!"bad round-robin");
>>     return NULL;
>>   }
>> @@ -2359,12 +2363,12 @@ struct ShowHostDB: public ShowCont
>>         HostDBRoundRobin *rr_data = r->rr();
>>         if (rr_data) {
>>           CHECK_SHOW(show("<table border=1>\n"));
>> -          CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n",
>> "Total", rr_data->n));
>> +          CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n",
>> "Total", rr_data->rrcount));
>>           CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n",
>>           "Good", rr_data->good));
>>           CHECK_SHOW(show("<tr><td>%s</td><td>%d</td></tr>\n",
>>           "Current", rr_data->current));
>>           CHECK_SHOW(show("</table>\n"));
>> 
>> -          for (int i = 0; i < rr_data->n; i++)
>> +          for (int i = 0; i < rr_data->rrcount; i++)
>>             showOne(&rr_data->info[i], true, event, e);
>>         }
>>       }
> 
> 
> This code (ugly mix of HTML and C) is surrounded by #ifdef NON_MODULAR
> which is #defined in lib/ts/ink_config.h if TS_HAS_STANDALONE_IOCORE 

Sure, but it would be weird to not rename the variable in some of the places.

J