unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Carl Worth <cworth@cworth.org>
To: "Jeffrey C. Ollie" <jeff@ocjtech.us>,
	Not Much Mail <notmuch@notmuchmail.org>
Subject: Re: [PATCH] Add private implementations of strndup and getline.
Date: Thu, 26 Nov 2009 13:06:31 -0800	[thread overview]
Message-ID: <87ocmpq9m0.fsf@yoom.home.cworth.org> (raw)
In-Reply-To: <1258983810-27522-2-git-send-email-jeff@ocjtech.us>

On Mon, 23 Nov 2009 07:43:30 -0600, "Jeffrey C. Ollie" <jeff@ocjtech.us> wrote:
> Add private implementations of strndup and getline for those platforms
> that don't have them (notably Mac OS X) no matter what preprocessor
> symbols you define.

Thanks. This is off to a very good start.

> +char *
> +_notmuch_strndup (const char *s, size_t n)
> +{
> +    size_t len = strlen (s);
> +    char *ret;
> +
> +    if (len <= n)
> +       return strdup (s);
> +
> +    ret = malloc(n + 1);

This needs to check and return NULL if malloc returns NULL.

> +/* getline implementation is copied from glibc. */

Then, this should have added a copyright attribution to the top of the
file.

In fact, everyone that's contributing non-trivial amounts should be
adding copyright statements. I don't mind too much if people consider
their own contributions to be insignificant enough to not merit a
copyright claim, but when copying code written by others, we definitely
need to bring the copyright attribution along.

Would also be good to mention the glibc version and license in this
comment and in the commit message as well.

-Carl

      parent reply	other threads:[~2009-11-26 21:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-22  3:07 [PATCH] Mac OS X compatibility fixes Jjgod Jiang
2009-11-22  4:17 ` Alexander Botero-Lowry
2009-11-22  4:31   ` Jjgod Jiang
2009-11-23  1:19     ` Carl Worth
2009-11-23 13:43       ` Jeffrey C. Ollie
2009-11-23 13:43         ` [PATCH] Add private implementations of strndup and getline Jeffrey C. Ollie
2009-11-23 18:14           ` [PATCH] Add tests to configure script to detect " Jeffrey C. Ollie
2009-11-27 22:06             ` Marten Veldthuis
2009-11-26 21:06           ` Carl Worth [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ocmpq9m0.fsf@yoom.home.cworth.org \
    --to=cworth@cworth.org \
    --cc=jeff@ocjtech.us \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.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).