From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcAV7-0003lu-Rh for qemu-devel@nongnu.org; Tue, 14 May 2013 04:22:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UcAV6-00009t-I6 for qemu-devel@nongnu.org; Tue, 14 May 2013 04:22:25 -0400 Received: from mail-wg0-x22c.google.com ([2a00:1450:400c:c00::22c]:50165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcADv-000395-OB for qemu-devel@nongnu.org; Tue, 14 May 2013 04:04:40 -0400 Received: by mail-wg0-f44.google.com with SMTP id z12so174750wgg.23 for ; Tue, 14 May 2013 01:04:39 -0700 (PDT) Date: Tue, 14 May 2013 10:04:31 +0200 From: Stefan Hajnoczi Message-ID: <20130514080431.GD3632@stefanha-thinkpad.redhat.com> References: <1368498390-20738-1-git-send-email-famz@redhat.com> <1368498390-20738-3-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1368498390-20738-3-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 02/11] curl: change magic number to macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Tue, May 14, 2013 at 10:26:21AM +0800, Fam Zheng wrote: > @@ -70,7 +70,8 @@ typedef struct CURLState > size_t buf_start; > size_t buf_off; > size_t buf_len; > - char range[128]; > +#define CURL_RANGE_SIZE 128 > + char range[CURL_RANGE_SIZE]; > char errmsg[CURL_ERROR_SIZE]; > char in_use; > } CURLState; > @@ -567,7 +568,7 @@ static void curl_readv_bh_cb(void *p) > state->orig_buf = g_malloc(state->buf_len); > state->acb[0] = acb; > > - snprintf(state->range, 127, "%zd-%zd", start, end); > + snprintf(state->range, CURL_RANGE_SIZE - 1, "%zd-%zd", start, end); Simpler solution: sizeof(state->range) - 1 Then you don't need to introduce "CURL_RANGE_SIZE" which risks conflicting with libcurl's namespace.