Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: bf417a015914f5ff9c4d42e765c9488bbd4637e7
      
https://github.com/Perl/perl5/commit/bf417a015914f5ff9c4d42e765c9488bbd4637e7
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-02-16 (Fri, 16 Feb 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Remove duplication in macro definitions

Because of the vagaries of locale handling on various platforms, there
are three separate implementations in this file of locale interactions
with libc.  These have been designed to present a common API to higher
level code, and it turns out that each implementation can be completely
defined by just two macros.  These macros present almost the same
interface to the caller, but have very different expansions.

The interface to the caller varies only by the parameter type.  If this
were C++, there would be two method names, and the compiler would decide
which version to call depending on the parameter type.

But it is plain C, and so there are three different versions of each of
the two macros, with suffixes in the names indicating the parameter type.

There are also three other derivaties of one of the macros.

Before this commit this underlying simplicity was obscured by each
implementation defining all 9 of its macros.  But it only has to define
the two, and common code later can define the 7 derivative ones.

Some of the implementations call libc functions that take a locale
category number; others call functions that use an index into an array.
For efficiency, each implementation defines the macro that interfaces
most naturally with its called functions.

Thus there are two variations of the common derived macros, defining
them in terms of the macro form the implementation defined.



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to