Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id DBB9B431FC0; Thu, 26 Nov 2009 13:06:45 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wwiWFt93n3De; Thu, 26 Nov 2009 13:06:45 -0800 (PST) Received: from cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D31CB431FAE; Thu, 26 Nov 2009 13:06:44 -0800 (PST) From: Carl Worth To: "Jeffrey C. Ollie" , Not Much Mail In-Reply-To: <1258983810-27522-2-git-send-email-jeff@ocjtech.us> References: <87bpiughr3.fsf@yoom.home.cworth.org> <1258983810-27522-1-git-send-email-jeff@ocjtech.us> <1258983810-27522-2-git-send-email-jeff@ocjtech.us> Date: Thu, 26 Nov 2009 13:06:31 -0800 Message-ID: <87ocmpq9m0.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [notmuch] [PATCH] Add private implementations of strndup and getline. X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2009 21:06:46 -0000 On Mon, 23 Nov 2009 07:43:30 -0600, "Jeffrey C. Ollie" 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