# Re: Mac OS 9 (Lamp) port

- From: Jonathan Nieder \<hidden\>
- Date: 2016-06-15 22:48:53 
- List: git
- Page: https://ratatoskr.run/git/2016/06/7466285
- Thread: https://ratatoskr.run/git/2016/06/7465679/t.md

```text
Joshua Juran wrote:

> diff --git a/server-info.c b/server-info.c
> index 4098ca2..a9a0188 100644
> --- a/server-info.c
> +++ b/server-info.c
> @@ -132,8 +132,8 @@ static int read_pack_info_file(const char *infofile)
> 
>  static int compare_info(const void *a_, const void *b_)
>  {
> -       struct pack_info *const *a = a_;
> -       struct pack_info *const *b = b_;
> +       const struct pack_info *const *a = a_;
> +       const struct pack_info *const *b = b_;
> 
>         if (0 <= (*a)->old_num && 0 <= (*b)->old_num)
>                 /* Keep the order in the original */
> 
> I certainly won't defend Metrowerks C 2.4.1, but the patch is
> harmless enough.

Yes, it is even a good change.

It just emphasized for me that Metrowerks is a little confused
about type qualifiers.

> 	#define alloc_n(type, n)  ((type*)xmalloc(sizeof (type) * n))
> 
> to factor the multiplication out of the calling code.

Maybe, imitating the signature of calloc:

 #define malloc_n(n, type) ((type *)xmalloc((n) * sizeof(type)))

For structs with variable-length arrays at the end:

 #define malloc_plus(type, extra) ((type *)xmalloc(sizeof(type) + (extra)))

That should cover most of the calls in git.

> I just want git to work on Lamp, and if
> there's community interest in C++ compatibility then I can assist
> with that.

There probably is not much direct interest.  But if in the process we
gain a little type-safety and portability, that would be nice. :)

Thanks for your hard work,
Jonathan
```
