public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] StdLib/BsdSocketLib: Remove unused variables
@ 2017-10-26  9:58 Thiebaud Weksteen
  2017-10-26 11:12 ` Laszlo Ersek
  2017-11-13 13:27 ` Laszlo Ersek
  0 siblings, 2 replies; 5+ messages in thread
From: Thiebaud Weksteen @ 2017-10-26  9:58 UTC (permalink / raw)
  To: edk2-devel; +Cc: erik.c.bjorge, Thiebaud Weksteen

TianoCore BZ#677

Remove unused variables and turn nsdispatch macro into a function. This
is not what is recommended in the bug ticket but avoid heavier
modification of the code (and deviation from upsteam).

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thiebaud Weksteen <tweek@google.com>
---
 StdLib/BsdSocketLib/getaddrinfo.c  | 10 ++++++----
 StdLib/BsdSocketLib/gethostbydns.c |  2 ++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/StdLib/BsdSocketLib/getaddrinfo.c b/StdLib/BsdSocketLib/getaddrinfo.c
index 5a0baf6d45..9d1acdb3fb 100644
--- a/StdLib/BsdSocketLib/getaddrinfo.c
+++ b/StdLib/BsdSocketLib/getaddrinfo.c
@@ -92,7 +92,6 @@ __RCSID("$NetBSD: getaddrinfo.c,v 1.91.6.1 2009/01/26 00:27:34 snj Exp $");
 #include <net/servent.h>
 
 #define endservent_r(svd)   endservent()
-#define nsdispatch(pResult,dtab,database,routine,files,hostname,pai)  NS_NOTFOUND
 #define res_nmkquery(state,op,dname,class,type,data,datalen,newrr_in,buf,buflen)  res_mkquery( op, dname, class, type, data, datalen, newrr_in, buf, buflen )
 #define res_nsend(state,buf,buflen,ans,anssiz)    res_send ( buf, buflen, ans, anssiz )
 
@@ -306,6 +305,12 @@ do { 								\
 #define MATCH(x, y, w) 							\
 	((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
 
+int nsdispatch(void *result, const ns_dtab dist_tab[], const char* database,
+               const char *method, const ns_src defaults[], ...)
+{
+  return NS_NOTFOUND;
+}
+
 const char *
 gai_strerror(int ecode)
 {
@@ -1062,9 +1067,6 @@ ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, u_int32_t *scopeid)
 
 /* code duplicate with gethnamaddr.c */
 
-static const char AskedForGot[] =
-	"gethostby*.getanswer: asked for \"%s\", got \"%s\"";
-
 static struct addrinfo *
 getanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
     const struct addrinfo *pai)
diff --git a/StdLib/BsdSocketLib/gethostbydns.c b/StdLib/BsdSocketLib/gethostbydns.c
index 25e7c3b142..17c43ba59c 100644
--- a/StdLib/BsdSocketLib/gethostbydns.c
+++ b/StdLib/BsdSocketLib/gethostbydns.c
@@ -129,8 +129,10 @@ u_int16_t _getshort(const u_char *src);
 #define	MAXALIASES	35
 #define	MAXADDRS	35
 
+#ifdef _ORG_FREEBSD_
 static const char AskedForGot[] =
 		"gethostby*.gethostanswer: asked for \"%s\", got \"%s\"";
+#endif
 
 static char *h_addr_ptrs[MAXADDRS + 1];
 
-- 
2.15.0.rc2.357.g7e34df9404-goog



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] StdLib/BsdSocketLib: Remove unused variables
  2017-10-26  9:58 [PATCH] StdLib/BsdSocketLib: Remove unused variables Thiebaud Weksteen
@ 2017-10-26 11:12 ` Laszlo Ersek
  2017-11-13 13:27 ` Laszlo Ersek
  1 sibling, 0 replies; 5+ messages in thread
From: Laszlo Ersek @ 2017-10-26 11:12 UTC (permalink / raw)
  To: Thiebaud Weksteen, edk2-devel; +Cc: erik.c.bjorge

Hello Thiebaud,

On 10/26/17 11:58, Thiebaud Weksteen wrote:
> TianoCore BZ#677

would you consider registering in the TianoCore Bugzilla, assigning this
item to yourself, and flipping its status to IN_PROGRESS?

Thanks!
Laszlo

> 
> Remove unused variables and turn nsdispatch macro into a function. This
> is not what is recommended in the bug ticket but avoid heavier
> modification of the code (and deviation from upsteam).
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Thiebaud Weksteen <tweek@google.com>
> ---
>  StdLib/BsdSocketLib/getaddrinfo.c  | 10 ++++++----
>  StdLib/BsdSocketLib/gethostbydns.c |  2 ++
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/StdLib/BsdSocketLib/getaddrinfo.c b/StdLib/BsdSocketLib/getaddrinfo.c
> index 5a0baf6d45..9d1acdb3fb 100644
> --- a/StdLib/BsdSocketLib/getaddrinfo.c
> +++ b/StdLib/BsdSocketLib/getaddrinfo.c
> @@ -92,7 +92,6 @@ __RCSID("$NetBSD: getaddrinfo.c,v 1.91.6.1 2009/01/26 00:27:34 snj Exp $");
>  #include <net/servent.h>
>  
>  #define endservent_r(svd)   endservent()
> -#define nsdispatch(pResult,dtab,database,routine,files,hostname,pai)  NS_NOTFOUND
>  #define res_nmkquery(state,op,dname,class,type,data,datalen,newrr_in,buf,buflen)  res_mkquery( op, dname, class, type, data, datalen, newrr_in, buf, buflen )
>  #define res_nsend(state,buf,buflen,ans,anssiz)    res_send ( buf, buflen, ans, anssiz )
>  
> @@ -306,6 +305,12 @@ do { 								\
>  #define MATCH(x, y, w) 							\
>  	((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
>  
> +int nsdispatch(void *result, const ns_dtab dist_tab[], const char* database,
> +               const char *method, const ns_src defaults[], ...)
> +{
> +  return NS_NOTFOUND;
> +}
> +
>  const char *
>  gai_strerror(int ecode)
>  {
> @@ -1062,9 +1067,6 @@ ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, u_int32_t *scopeid)
>  
>  /* code duplicate with gethnamaddr.c */
>  
> -static const char AskedForGot[] =
> -	"gethostby*.getanswer: asked for \"%s\", got \"%s\"";
> -
>  static struct addrinfo *
>  getanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
>      const struct addrinfo *pai)
> diff --git a/StdLib/BsdSocketLib/gethostbydns.c b/StdLib/BsdSocketLib/gethostbydns.c
> index 25e7c3b142..17c43ba59c 100644
> --- a/StdLib/BsdSocketLib/gethostbydns.c
> +++ b/StdLib/BsdSocketLib/gethostbydns.c
> @@ -129,8 +129,10 @@ u_int16_t _getshort(const u_char *src);
>  #define	MAXALIASES	35
>  #define	MAXADDRS	35
>  
> +#ifdef _ORG_FREEBSD_
>  static const char AskedForGot[] =
>  		"gethostby*.gethostanswer: asked for \"%s\", got \"%s\"";
> +#endif
>  
>  static char *h_addr_ptrs[MAXADDRS + 1];
>  
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] StdLib/BsdSocketLib: Remove unused variables
  2017-10-26  9:58 [PATCH] StdLib/BsdSocketLib: Remove unused variables Thiebaud Weksteen
  2017-10-26 11:12 ` Laszlo Ersek
@ 2017-11-13 13:27 ` Laszlo Ersek
  2017-11-13 15:40   ` Carsey, Jaben
  1 sibling, 1 reply; 5+ messages in thread
From: Laszlo Ersek @ 2017-11-13 13:27 UTC (permalink / raw)
  To: Thiebaud Weksteen, edk2-devel, Daryl McDaniel, Jaben Carsey; +Cc: erik.c.bjorge

Jaben, Daryl,

can you please review this patch?

Thiebaud: best CC the package maintainers from Maintainers.txt on patches.

Thanks!
Laszlo

On 10/26/17 11:58, Thiebaud Weksteen wrote:
> TianoCore BZ#677
> 
> Remove unused variables and turn nsdispatch macro into a function. This
> is not what is recommended in the bug ticket but avoid heavier
> modification of the code (and deviation from upsteam).
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Thiebaud Weksteen <tweek@google.com>
> ---
>  StdLib/BsdSocketLib/getaddrinfo.c  | 10 ++++++----
>  StdLib/BsdSocketLib/gethostbydns.c |  2 ++
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/StdLib/BsdSocketLib/getaddrinfo.c b/StdLib/BsdSocketLib/getaddrinfo.c
> index 5a0baf6d45..9d1acdb3fb 100644
> --- a/StdLib/BsdSocketLib/getaddrinfo.c
> +++ b/StdLib/BsdSocketLib/getaddrinfo.c
> @@ -92,7 +92,6 @@ __RCSID("$NetBSD: getaddrinfo.c,v 1.91.6.1 2009/01/26 00:27:34 snj Exp $");
>  #include <net/servent.h>
>  
>  #define endservent_r(svd)   endservent()
> -#define nsdispatch(pResult,dtab,database,routine,files,hostname,pai)  NS_NOTFOUND
>  #define res_nmkquery(state,op,dname,class,type,data,datalen,newrr_in,buf,buflen)  res_mkquery( op, dname, class, type, data, datalen, newrr_in, buf, buflen )
>  #define res_nsend(state,buf,buflen,ans,anssiz)    res_send ( buf, buflen, ans, anssiz )
>  
> @@ -306,6 +305,12 @@ do { 								\
>  #define MATCH(x, y, w) 							\
>  	((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
>  
> +int nsdispatch(void *result, const ns_dtab dist_tab[], const char* database,
> +               const char *method, const ns_src defaults[], ...)
> +{
> +  return NS_NOTFOUND;
> +}
> +
>  const char *
>  gai_strerror(int ecode)
>  {
> @@ -1062,9 +1067,6 @@ ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, u_int32_t *scopeid)
>  
>  /* code duplicate with gethnamaddr.c */
>  
> -static const char AskedForGot[] =
> -	"gethostby*.getanswer: asked for \"%s\", got \"%s\"";
> -
>  static struct addrinfo *
>  getanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
>      const struct addrinfo *pai)
> diff --git a/StdLib/BsdSocketLib/gethostbydns.c b/StdLib/BsdSocketLib/gethostbydns.c
> index 25e7c3b142..17c43ba59c 100644
> --- a/StdLib/BsdSocketLib/gethostbydns.c
> +++ b/StdLib/BsdSocketLib/gethostbydns.c
> @@ -129,8 +129,10 @@ u_int16_t _getshort(const u_char *src);
>  #define	MAXALIASES	35
>  #define	MAXADDRS	35
>  
> +#ifdef _ORG_FREEBSD_
>  static const char AskedForGot[] =
>  		"gethostby*.gethostanswer: asked for \"%s\", got \"%s\"";
> +#endif
>  
>  static char *h_addr_ptrs[MAXADDRS + 1];
>  
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] StdLib/BsdSocketLib: Remove unused variables
  2017-11-13 13:27 ` Laszlo Ersek
@ 2017-11-13 15:40   ` Carsey, Jaben
  2017-11-13 16:30     ` Laszlo Ersek
  0 siblings, 1 reply; 5+ messages in thread
From: Carsey, Jaben @ 2017-11-13 15:40 UTC (permalink / raw)
  To: Laszlo Ersek, Thiebaud Weksteen, edk2-devel@lists.01.org,
	Daryl McDaniel
  Cc: Bjorge, Erik C

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

And pushed.

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Laszlo Ersek
> Sent: Monday, November 13, 2017 5:27 AM
> To: Thiebaud Weksteen <tweek@google.com>; edk2-devel@lists.01.org;
> Daryl McDaniel <edk2-lists@mc2research.org>; Carsey, Jaben
> <jaben.carsey@intel.com>
> Cc: Bjorge, Erik C <erik.c.bjorge@intel.com>
> Subject: Re: [edk2] [PATCH] StdLib/BsdSocketLib: Remove unused variables
> Importance: High
> 
> Jaben, Daryl,
> 
> can you please review this patch?
> 
> Thiebaud: best CC the package maintainers from Maintainers.txt on patches.
> 
> Thanks!
> Laszlo
> 
> On 10/26/17 11:58, Thiebaud Weksteen wrote:
> > TianoCore BZ#677
> >
> > Remove unused variables and turn nsdispatch macro into a function. This
> > is not what is recommended in the bug ticket but avoid heavier
> > modification of the code (and deviation from upsteam).
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Thiebaud Weksteen <tweek@google.com>
> > ---
> >  StdLib/BsdSocketLib/getaddrinfo.c  | 10 ++++++----
> >  StdLib/BsdSocketLib/gethostbydns.c |  2 ++
> >  2 files changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/StdLib/BsdSocketLib/getaddrinfo.c
> b/StdLib/BsdSocketLib/getaddrinfo.c
> > index 5a0baf6d45..9d1acdb3fb 100644
> > --- a/StdLib/BsdSocketLib/getaddrinfo.c
> > +++ b/StdLib/BsdSocketLib/getaddrinfo.c
> > @@ -92,7 +92,6 @@ __RCSID("$NetBSD: getaddrinfo.c,v 1.91.6.1
> 2009/01/26 00:27:34 snj Exp $");
> >  #include <net/servent.h>
> >
> >  #define endservent_r(svd)   endservent()
> > -#define nsdispatch(pResult,dtab,database,routine,files,hostname,pai)
> NS_NOTFOUND
> >  #define
> res_nmkquery(state,op,dname,class,type,data,datalen,newrr_in,buf,buflen
> )  res_mkquery( op, dname, class, type, data, datalen, newrr_in, buf, buflen )
> >  #define res_nsend(state,buf,buflen,ans,anssiz)    res_send ( buf, buflen,
> ans, anssiz )
> >
> > @@ -306,6 +305,12 @@ do {
> 		\
> >  #define MATCH(x, y, w)
> 	\
> >  	((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
> >
> > +int nsdispatch(void *result, const ns_dtab dist_tab[], const char*
> database,
> > +               const char *method, const ns_src defaults[], ...)
> > +{
> > +  return NS_NOTFOUND;
> > +}
> > +
> >  const char *
> >  gai_strerror(int ecode)
> >  {
> > @@ -1062,9 +1067,6 @@ ip6_str2scopeid(char *scope, struct sockaddr_in6
> *sin6, u_int32_t *scopeid)
> >
> >  /* code duplicate with gethnamaddr.c */
> >
> > -static const char AskedForGot[] =
> > -	"gethostby*.getanswer: asked for \"%s\", got \"%s\"";
> > -
> >  static struct addrinfo *
> >  getanswer(const querybuf *answer, int anslen, const char *qname, int
> qtype,
> >      const struct addrinfo *pai)
> > diff --git a/StdLib/BsdSocketLib/gethostbydns.c
> b/StdLib/BsdSocketLib/gethostbydns.c
> > index 25e7c3b142..17c43ba59c 100644
> > --- a/StdLib/BsdSocketLib/gethostbydns.c
> > +++ b/StdLib/BsdSocketLib/gethostbydns.c
> > @@ -129,8 +129,10 @@ u_int16_t _getshort(const u_char *src);
> >  #define	MAXALIASES	35
> >  #define	MAXADDRS	35
> >
> > +#ifdef _ORG_FREEBSD_
> >  static const char AskedForGot[] =
> >  		"gethostby*.gethostanswer: asked for \"%s\", got \"%s\"";
> > +#endif
> >
> >  static char *h_addr_ptrs[MAXADDRS + 1];
> >
> >
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] StdLib/BsdSocketLib: Remove unused variables
  2017-11-13 15:40   ` Carsey, Jaben
@ 2017-11-13 16:30     ` Laszlo Ersek
  0 siblings, 0 replies; 5+ messages in thread
From: Laszlo Ersek @ 2017-11-13 16:30 UTC (permalink / raw)
  To: Carsey, Jaben, Thiebaud Weksteen, edk2-devel@lists.01.org,
	Daryl McDaniel
  Cc: Bjorge, Erik C

On 11/13/17 16:40, Carsey, Jaben wrote:
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> 
> And pushed.

Thank you both! I closed
<https://bugzilla.tianocore.org/show_bug.cgi?id=677> as RESOLVED/FIXED.

Cheers
Laszlo

>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Laszlo Ersek
>> Sent: Monday, November 13, 2017 5:27 AM
>> To: Thiebaud Weksteen <tweek@google.com>; edk2-devel@lists.01.org;
>> Daryl McDaniel <edk2-lists@mc2research.org>; Carsey, Jaben
>> <jaben.carsey@intel.com>
>> Cc: Bjorge, Erik C <erik.c.bjorge@intel.com>
>> Subject: Re: [edk2] [PATCH] StdLib/BsdSocketLib: Remove unused variables
>> Importance: High
>>
>> Jaben, Daryl,
>>
>> can you please review this patch?
>>
>> Thiebaud: best CC the package maintainers from Maintainers.txt on patches.
>>
>> Thanks!
>> Laszlo
>>
>> On 10/26/17 11:58, Thiebaud Weksteen wrote:
>>> TianoCore BZ#677
>>>
>>> Remove unused variables and turn nsdispatch macro into a function. This
>>> is not what is recommended in the bug ticket but avoid heavier
>>> modification of the code (and deviation from upsteam).
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Thiebaud Weksteen <tweek@google.com>
>>> ---
>>>  StdLib/BsdSocketLib/getaddrinfo.c  | 10 ++++++----
>>>  StdLib/BsdSocketLib/gethostbydns.c |  2 ++
>>>  2 files changed, 8 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/StdLib/BsdSocketLib/getaddrinfo.c
>> b/StdLib/BsdSocketLib/getaddrinfo.c
>>> index 5a0baf6d45..9d1acdb3fb 100644
>>> --- a/StdLib/BsdSocketLib/getaddrinfo.c
>>> +++ b/StdLib/BsdSocketLib/getaddrinfo.c
>>> @@ -92,7 +92,6 @@ __RCSID("$NetBSD: getaddrinfo.c,v 1.91.6.1
>> 2009/01/26 00:27:34 snj Exp $");
>>>  #include <net/servent.h>
>>>
>>>  #define endservent_r(svd)   endservent()
>>> -#define nsdispatch(pResult,dtab,database,routine,files,hostname,pai)
>> NS_NOTFOUND
>>>  #define
>> res_nmkquery(state,op,dname,class,type,data,datalen,newrr_in,buf,buflen
>> )  res_mkquery( op, dname, class, type, data, datalen, newrr_in, buf, buflen )
>>>  #define res_nsend(state,buf,buflen,ans,anssiz)    res_send ( buf, buflen,
>> ans, anssiz )
>>>
>>> @@ -306,6 +305,12 @@ do {
>> 		\
>>>  #define MATCH(x, y, w)
>> 	\
>>>  	((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
>>>
>>> +int nsdispatch(void *result, const ns_dtab dist_tab[], const char*
>> database,
>>> +               const char *method, const ns_src defaults[], ...)
>>> +{
>>> +  return NS_NOTFOUND;
>>> +}
>>> +
>>>  const char *
>>>  gai_strerror(int ecode)
>>>  {
>>> @@ -1062,9 +1067,6 @@ ip6_str2scopeid(char *scope, struct sockaddr_in6
>> *sin6, u_int32_t *scopeid)
>>>
>>>  /* code duplicate with gethnamaddr.c */
>>>
>>> -static const char AskedForGot[] =
>>> -	"gethostby*.getanswer: asked for \"%s\", got \"%s\"";
>>> -
>>>  static struct addrinfo *
>>>  getanswer(const querybuf *answer, int anslen, const char *qname, int
>> qtype,
>>>      const struct addrinfo *pai)
>>> diff --git a/StdLib/BsdSocketLib/gethostbydns.c
>> b/StdLib/BsdSocketLib/gethostbydns.c
>>> index 25e7c3b142..17c43ba59c 100644
>>> --- a/StdLib/BsdSocketLib/gethostbydns.c
>>> +++ b/StdLib/BsdSocketLib/gethostbydns.c
>>> @@ -129,8 +129,10 @@ u_int16_t _getshort(const u_char *src);
>>>  #define	MAXALIASES	35
>>>  #define	MAXADDRS	35
>>>
>>> +#ifdef _ORG_FREEBSD_
>>>  static const char AskedForGot[] =
>>>  		"gethostby*.gethostanswer: asked for \"%s\", got \"%s\"";
>>> +#endif
>>>
>>>  static char *h_addr_ptrs[MAXADDRS + 1];
>>>
>>>
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-13 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26  9:58 [PATCH] StdLib/BsdSocketLib: Remove unused variables Thiebaud Weksteen
2017-10-26 11:12 ` Laszlo Ersek
2017-11-13 13:27 ` Laszlo Ersek
2017-11-13 15:40   ` Carsey, Jaben
2017-11-13 16:30     ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox