[ 
https://issues.apache.org/jira/browse/TS-1953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13726913#comment-13726913
 ] 

Igor Galić edited comment on TS-1953 at 8/1/13 9:28 PM:
--------------------------------------------------------

{code}
bool
TSVersionLE(int major, int minor = INT_MAX, int patch = INT_MAX)
{
  if (!(TS_MAJOR <= major)){
    return false;
  }
  if (!(TS_MINOR <= minor)) {
    return false;
  }
  if (!(TS_PATCH <= patch)) {
    return false;
  }
  return true;
}
{code}

I think adding these two should suffice to save us from lots of repetitive 
boiler code.
                
      was (Author: i.galic):
    {code}
bool
TSVersionLE(int major, int minor = -1, int patch = -1)
{
  if (!(TS_MAJOR <= major)){
    return false;
  }
  if (minor != -1 && !(TS_MINOR <= minor)) {
    return false;
  }
  if (patch != -1 && !(TS_PATCH <= patch)) {
    return false;
  }
  return true;
}
{code}

I think adding these two should suffice to save us from lots of repetitive 
boiler code.
                  
> remove check_ts_version() from (example) plugins or make it an API
> ------------------------------------------------------------------
>
>                 Key: TS-1953
>                 URL: https://issues.apache.org/jira/browse/TS-1953
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: Plugins
>            Reporter: Igor Galić
>             Fix For: sometime
>
>
> almost every single of our (example) plugins has a function 
> {{chec_ts_version()}}. If this boiler-code is so crucial to a plugin's 
> functionality, we should offer an API for it, instead of making developers 
> write (copy) that code every time.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to