unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 70341cab3e: string-equal-ignore-case: new function
       [not found] ` <20220726175007.02EE9C00095@vcs2.savannah.gnu.org>
@ 2022-07-26 17:58   ` Lars Ingebrigtsen
  2022-07-26 18:21     ` Sam Steingold
  2022-07-26 19:00   ` Roland Winkler
  1 sibling, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-26 17:58 UTC (permalink / raw)
  To: Sam Steingold; +Cc: emacs-devel

Sam Steingold <sds@gnu.org> writes:

> -;; case-insensitive case, but it has to cope with null args.
> -;; (`string-equal' uses symbol print names.)
> -(defun gnus-string-equal (x y)
> -  "Like `string-equal', except it compares case-insensitively."
> -  (and (= (length x) (length y))
> -       (or (string-equal x y)
> -	   (string-equal (downcase x) (downcase y)))))

We don't remove non-internal functions like this (because they may be
used by third parties).  Instead make it obsolete.

> -	      (when (gnus-string-equal
> +	      (when (string-equal-ignore-case
>  		     (message-fetch-field "followup-to")
>  		     (message-fetch-field "newsgroups"))

And the arguments here may be nil, which will signal an error.





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

* Re: master 70341cab3e: string-equal-ignore-case: new function
  2022-07-26 17:58   ` master 70341cab3e: string-equal-ignore-case: new function Lars Ingebrigtsen
@ 2022-07-26 18:21     ` Sam Steingold
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Steingold @ 2022-07-26 18:21 UTC (permalink / raw)
  To: emacs-devel, Lars Ingebrigtsen

> * Lars Ingebrigtsen <ynefv@tahf.bet> [2022-07-26 19:58:06 +0200]:
>
> Sam Steingold <sds@gnu.org> writes:
>
>> -;; case-insensitive case, but it has to cope with null args.
>> -;; (`string-equal' uses symbol print names.)
>> -(defun gnus-string-equal (x y)
>> -  "Like `string-equal', except it compares case-insensitively."
>> -  (and (= (length x) (length y))
>> -       (or (string-equal x y)
>> -	   (string-equal (downcase x) (downcase y)))))
>
> We don't remove non-internal functions like this (because they may be
> used by third parties).  Instead make it obsolete.

fixed, thanks.

>> -	      (when (gnus-string-equal
>> +	      (when (string-equal-ignore-case
>>  		     (message-fetch-field "followup-to")
>>  		     (message-fetch-field "newsgroups"))
>
> And the arguments here may be nil, which will signal an error.

I thought I checked all uses of `gnus-string-equal', sorry...

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
https://mideasttruth.com https://camera.org http://think-israel.org
char*a="char*a=%c%s%c;main(){printf(a,34,a,34);}";main(){printf(a,34,a,34);}



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

* Re: master 70341cab3e: string-equal-ignore-case: new function
       [not found] ` <20220726175007.02EE9C00095@vcs2.savannah.gnu.org>
  2022-07-26 17:58   ` master 70341cab3e: string-equal-ignore-case: new function Lars Ingebrigtsen
@ 2022-07-26 19:00   ` Roland Winkler
  2022-07-26 19:44     ` Sam Steingold
  1 sibling, 1 reply; 4+ messages in thread
From: Roland Winkler @ 2022-07-26 19:00 UTC (permalink / raw)
  To: emacs-devel; +Cc: Sam Steingold

On Tue, Jul 26 2022, Sam Steingold wrote:
> +(defun string-equal-ignore-case (string1 string2)
> +  "Like `string-equal', but case-insensitive.
> +Upper-case and lower-case letters are treated as equal.
> +Unibyte strings are converted to multibyte for comparison."
> +  (eq t (compare-strings string1 0 nil string2 0 nil t)))

Isn't this a perfect candidate for an inline function,
i.e., defsubst instead of defun?



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

* Re: master 70341cab3e: string-equal-ignore-case: new function
  2022-07-26 19:00   ` Roland Winkler
@ 2022-07-26 19:44     ` Sam Steingold
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Steingold @ 2022-07-26 19:44 UTC (permalink / raw)
  To: emacs-devel, Roland Winkler

> * Roland Winkler <jvaxyre@tah.bet> [2022-07-26 14:00:53 -0500]:
>
> On Tue, Jul 26 2022, Sam Steingold wrote:
>> +(defun string-equal-ignore-case (string1 string2)
>> +  "Like `string-equal', but case-insensitive.
>> +Upper-case and lower-case letters are treated as equal.
>> +Unibyte strings are converted to multibyte for comparison."
>> +  (eq t (compare-strings string1 0 nil string2 0 nil t)))
>
> Isn't this a perfect candidate for an inline function,
> i.e., defsubst instead of defun?

Probably...
I can probably add more declarations...

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
https://www.peaceandtolerance.org/ https://camera.org
Whether pronounced "leenooks" or "line-uks", it's better than Windows.



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

end of thread, other threads:[~2022-07-26 19:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <165885780615.5477.9618918327695992186@vcs2.savannah.gnu.org>
     [not found] ` <20220726175007.02EE9C00095@vcs2.savannah.gnu.org>
2022-07-26 17:58   ` master 70341cab3e: string-equal-ignore-case: new function Lars Ingebrigtsen
2022-07-26 18:21     ` Sam Steingold
2022-07-26 19:00   ` Roland Winkler
2022-07-26 19:44     ` Sam Steingold

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).