From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2710 invoked by alias); 28 Sep 2012 20:07:33 -0000 Received: (qmail 2688 invoked by uid 22791); 28 Sep 2012 20:07:32 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_CP X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Sep 2012 20:07:27 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8SK7Pbb001648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 Sep 2012 16:07:25 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8SK7Nxk025711 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 28 Sep 2012 16:07:24 -0400 From: Tom Tromey To: Giuseppe MONTALTO Cc: "gdb-patches\@sourceware.org" , "Abid\, Hafiz" Subject: Re: [PATCH] enhancement of mi_cmd_data_write_memory_bytes for filling memory regions (was [PATCH] new MI command for pattern filling of memory regions) References: <76FE3225DF13124EA2D05B290B624C95E65F2D466E@SAFEX1MAIL1.st.com> <87sjf9rzr0.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E65FECE356@SAFEX1MAIL1.st.com> <871umsqgu8.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E65FECE48F@SAFEX1MAIL1.st.com> <87397624b9.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E662A6921F@SAFEX1MAIL1.st.com> <76FE3225DF13124EA2D05B290B624C95E6632A4256@SAFEX1MAIL1.st.com> <878vcc1s9f.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E66B003EA8@SAFEX1MAIL1.st.com> <87wqzgwm4k.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E66B004AC6@SAFEX1MAIL1.st.com> Date: Fri, 28 Sep 2012 20:07:00 -0000 In-Reply-To: <76FE3225DF13124EA2D05B290B624C95E66B004AC6@SAFEX1MAIL1.st.com> (Giuseppe MONTALTO's message of "Thu, 27 Sep 2012 17:26:32 +0200") Message-ID: <87r4plsyh0.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-09/txt/msg00698.txt.bz2 >>>>> "Giuseppe" == Giuseppe MONTALTO writes: Giuseppe> the attached patch should fix all the issues. Thanks. Unfortunately I thought of one more little thing. Giuseppe> + remainder = count % len; /* there may be some spare bytes. */ Comment should start with a capital letter. Though TBH you could also just remove this comment since I think the code is already clear. Giuseppe> + if (remainder > 0) /* copy spare bytes too. */ Likewise on both counts. Giuseppe> + else if (len > count) Giuseppe> + { Giuseppe> + /* Pattern is longer than count: Giuseppe> + just copy len bytes. */ Giuseppe> + data = xmalloc (len); Giuseppe> + make_cleanup (xfree, data); Giuseppe> + memcpy (data, databuf, len); There's no need to copy the data here. Just set data=databuf. Tom