* Re: [devel] [git update] packages/rpm: heads/master @ 2007-11-20 11:12 ` Slava Semushin 2007-11-20 11:18 ` Alexey Tourbin 0 siblings, 1 reply; 3+ messages in thread From: Slava Semushin @ 2007-11-20 11:12 UTC (permalink / raw) To: ALT Devel discussion list 2007/11/19, Alex V. Myltsev <avm / altlinux.org>: > Update of /people/avm/packages/rpm.git [...] > --- a/build/reqprov.c > +++ b/build/reqprov.c [...] > +#define PRIVATE_PREFIX "[private]" > + > +/* If there is a PRIVATE_PREFIX at the beginning of depName, skip it. */ > +__attribute__((visibility ("hidden"))) > +const char* rpmStripDepPrefix(const char* depName) > +{ > + if (!strncmp(depName, PRIVATE_PREFIX, strlen(PRIVATE_PREFIX))) { > + depName += strlen(PRIVATE_PREFIX); > + } > + return depName; > +} > + [...] Почему бы не заменить strlen(PRIVATE_PREFIX) на sizeof(PRIVATE_PREFIX)-1 ? Читабельность кода чуток уменьшится, зато длинна строки оба раза будет вычисляться при компиляции, а не в run-time. Это я так, лишь предлагаю. -- + Slava Semushin | slava.semushin @ gmail.com + ALT Linux Team | php-coder @ altlinux.ru ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [devel] [git update] packages/rpm: heads/master 2007-11-20 11:12 ` [devel] [git update] packages/rpm: heads/master Slava Semushin @ 2007-11-20 11:18 ` Alexey Tourbin 2007-11-20 12:08 ` Денис Смирнов 0 siblings, 1 reply; 3+ messages in thread From: Alexey Tourbin @ 2007-11-20 11:18 UTC (permalink / raw) To: ALT Devel discussion list [-- Attachment #1: Type: text/plain, Size: 962 bytes --] On Tue, Nov 20, 2007 at 05:12:59PM +0600, Slava Semushin wrote: > 2007/11/19, Alex V. Myltsev <avm / altlinux.org>: > > Update of /people/avm/packages/rpm.git > [...] > > --- a/build/reqprov.c > > +++ b/build/reqprov.c > [...] > > +#define PRIVATE_PREFIX "[private]" > > + > > +/* If there is a PRIVATE_PREFIX at the beginning of depName, skip it. */ > > +__attribute__((visibility ("hidden"))) > > +const char* rpmStripDepPrefix(const char* depName) > > +{ > > + if (!strncmp(depName, PRIVATE_PREFIX, strlen(PRIVATE_PREFIX))) { > > + depName += strlen(PRIVATE_PREFIX); > > + } > > + return depName; > > +} > > + > [...] > > Почему бы не заменить strlen(PRIVATE_PREFIX) на sizeof(PRIVATE_PREFIX)-1 ? > > Читабельность кода чуток уменьшится, зато длинна строки оба раза будет > вычисляться при компиляции, а не в run-time. Кажется gcc умеет оптимизировать strlen для константных строк. > Это я так, лишь предлагаю. [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [devel] [git update] packages/rpm: heads/master 2007-11-20 11:18 ` Alexey Tourbin @ 2007-11-20 12:08 ` Денис Смирнов 0 siblings, 0 replies; 3+ messages in thread From: Денис Смирнов @ 2007-11-20 12:08 UTC (permalink / raw) To: ALT Linux Team development discussions [-- Attachment #1: Type: text/plain, Size: 559 bytes --] On Tue, Nov 20, 2007 at 02:18:01PM +0300, Алексей Турбин wrote: >> Почему бы не заменить strlen(PRIVATE_PREFIX) на sizeof(PRIVATE_PREFIX)-1 ? >> Читабельность кода чуток уменьшится, зато длинна строки оба раза будет >> вычисляться при компиляции, а не в run-time. AT> Кажется gcc умеет оптимизировать strlen для константных строк. Причем даже с -O0. -- С уважением, Денис http://freesource.info ---------------------------------------------------------------------------- Буду пока не собирать ничего с GraphicsMagik. -- zerg in #10165 [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-20 12:08 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-11-20 11:12 ` [devel] [git update] packages/rpm: heads/master Slava Semushin 2007-11-20 11:18 ` Alexey Tourbin 2007-11-20 12:08 ` Денис Смирнов
ALT Linux Team development discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \ devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru public-inbox-index devel Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git