linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: sparse | upgrade to upstream v0.6.2 (!2)
       [not found]   ` <note_184887@salsa.debian.org>
@ 2020-08-01 16:54     ` Luc Van Oostenryck
  0 siblings, 0 replies; 14+ messages in thread
From: Luc Van Oostenryck @ 2020-08-01 16:54 UTC (permalink / raw)
  To: Uwe Kleine-König / sparse; +Cc: linux-sparse

On Sat, Aug 01, 2020 at 06:51:42AM +0000, Uwe Kleine-König wrote:
> Uwe Kleine-König commented:
> 
> 
> What I didn't do compared to your MR is to add the patch "gensel: remove unneeded test/uninitialized warning" to fix a build warning.

I've added a 'maintenance' branch on the official tree: 
  git://git.kernel.org/pub/scm/devel/sparse/sparse.git maint-v0.6.2

which contains a few fixup patches I think the Debian release should have.
It contains, the 'gensel' patch here above (not very important, it just fix
a warning), your patch for sindex.1 (same), the build fix for Hurd and
most importantly it contains a patch for a real bug making sparse crash:
  77f35b796cc8 ("generic: fix missing inlining of generic expression")

Thanks,
-- Luc

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
       [not found]   ` <note_184882@salsa.debian.org>
@ 2020-08-02 13:29     ` Luc Van Oostenryck
  2020-08-09 19:21     ` Luc Van Oostenryck
  1 sibling, 0 replies; 14+ messages in thread
From: Luc Van Oostenryck @ 2020-08-02 13:29 UTC (permalink / raw)
  To: Uwe Kleine-König / sparse; +Cc: linux-sparse

For the build failure on X32:
  /usr/include/x86_64-linux-gnux32/gnu/stubs.h:7:12: error: unable to open 'gnu/stubs-32.h'

Sparse should be called with '--arch=x86_64 -mx32' but the error
indicate that '__x86_64__' is not even defined, as if another
architecture was selected. Very strange.
I can't reproduce this here (nor in my old setup, nor in a brand
new reinstall of a x32 chroot).


The output of:
   env CHECK=./sparse ./cgcc -v -no-compile memops.c
should be:
  ./sparse -v --arch=x86_64 <lots of defines for floats> -mx32 --os=linux -gcc-base-dir /usr/lib/gcc/x86_64-linux-gnux32/10/ -multiarch-dir x86_64-linux-gnux32 memops.c

I absolutely don't see what can be wrong. But I wonder why it
happens first or only on memops.c and not on one of the file
listed earlier, for example allocate.c?

-- Luc

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
       [not found]     ` <note_185156@salsa.debian.org>
@ 2020-08-02 21:09       ` Luc Van Oostenryck
  0 siblings, 0 replies; 14+ messages in thread
From: Luc Van Oostenryck @ 2020-08-02 21:09 UTC (permalink / raw)
  To: Uwe Kleine-König / sparse; +Cc: linux-sparse

On Sun, Aug 02, 2020 at 08:19:46PM +0000, Uwe Kleine-König wrote:
> Uwe Kleine-König commented on a discussion: https://salsa.debian.org/ukleinek/sparse/-/merge_requests/2#note_185156
> 
> It only fails for memops.c because it is only called for that one. See
> https://salsa.debian.org/ukleinek/sparse/-/blob/debian-unstable/debian/rules

Ah yes, OK :)
I thought 'make selfcheck' was called.

-- Luc

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
       [not found]     ` <note_185155@salsa.debian.org>
@ 2020-08-02 21:30       ` Luc Van Oostenryck
  2020-08-03 14:53         ` Alexey Gladkov
  0 siblings, 1 reply; 14+ messages in thread
From: Luc Van Oostenryck @ 2020-08-02 21:30 UTC (permalink / raw)
  To: Uwe Kleine-König / sparse; +Cc: linux-sparse, Alexey Gladkov

On Sun, Aug 02, 2020 at 08:18:42PM +0000, Uwe Kleine-König wrote:
> Uwe Kleine-König commented on a discussion: https://salsa.debian.org/ukleinek/sparse/-/merge_requests/2#note_185155
> 
> There is still another issue that popped up in the meantime: 
> https://bugs.debian.org/966706

Hmmm, I think that a corner of my mind was silently worried it
will happen.

> The options are:
> 
>  - add a Conflicts: biosquid
>    (this is the ugliest option)
>  - rename sindex to something else
>  - convince the bioquid people to rename their sindex
>  - stop shipping sindex
> 
> For now I will go for "stop shipping sindex", do you have an opinion for a long-term plan?

[+CC to sindex's author]

Not really.
Would it be easy to install it under the name 'sparse-sindex' or
'sparse-index'?

One thing I would like (in some future release) is to split
the sparse package at least in 2:
* one with sparse itself
  - it has no dependencies (except the libc, a compiler compatible
    with gcc and GNU make for the build)
  - maybe cgcc should be included in the package too (which would
    add a dependency on perl)
* one with the others tools
  - but maybe it would even be better to the big ones in their
    own packages with their own dependencies)
But this would not really solve the problem here.

-- Luc

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
  2020-08-02 21:30       ` Luc Van Oostenryck
@ 2020-08-03 14:53         ` Alexey Gladkov
  2020-08-04 16:38           ` Alexey Gladkov
  0 siblings, 1 reply; 14+ messages in thread
From: Alexey Gladkov @ 2020-08-03 14:53 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Uwe Kleine-König / sparse, linux-sparse

On Sun, Aug 02, 2020 at 11:30:35PM +0200, Luc Van Oostenryck wrote:
> On Sun, Aug 02, 2020 at 08:18:42PM +0000, Uwe Kleine-König wrote:
> > Uwe Kleine-König commented on a discussion: https://salsa.debian.org/ukleinek/sparse/-/merge_requests/2#note_185155
> > 
> > There is still another issue that popped up in the meantime: 
> > https://bugs.debian.org/966706
> 
> Hmmm, I think that a corner of my mind was silently worried it
> will happen.
> 
> > The options are:
> > 
> >  - add a Conflicts: biosquid
> >    (this is the ugliest option)
> >  - rename sindex to something else
> >  - convince the bioquid people to rename their sindex
> >  - stop shipping sindex
> > 
> > For now I will go for "stop shipping sindex", do you have an opinion for a long-term plan?
> 
> [+CC to sindex's author]
> 
> Not really.
> Would it be easy to install it under the name 'sparse-sindex' or
> 'sparse-index'?
> 
> One thing I would like (in some future release) is to split
> the sparse package at least in 2:
> * one with sparse itself
>   - it has no dependencies (except the libc, a compiler compatible
>     with gcc and GNU make for the build)
>   - maybe cgcc should be included in the package too (which would
>     add a dependency on perl)
> * one with the others tools
>   - but maybe it would even be better to the big ones in their
>     own packages with their own dependencies)
> But this would not really solve the problem here.

Renaming of sindex was an option for me, but since you have a plan
to split the package anyway, then I think it's better to do so. I tried to
use the libsparse.a and it looks like it works fine [1].

I spoke with Oleg Nesterov and he also does not mind moving this utility
to a separate repository.

[1] https://github.com/legionus/sindex

-- 
Rgrds, legion


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
  2020-08-03 14:53         ` Alexey Gladkov
@ 2020-08-04 16:38           ` Alexey Gladkov
  2020-08-04 18:52             ` Oleg Nesterov
                               ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Alexey Gladkov @ 2020-08-04 16:38 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: Uwe Kleine-König / sparse, linux-sparse, Oleg Nesterov

On Mon, Aug 03, 2020 at 04:53:10PM +0200, Alexey Gladkov wrote:
> On Sun, Aug 02, 2020 at 11:30:35PM +0200, Luc Van Oostenryck wrote:
> > On Sun, Aug 02, 2020 at 08:18:42PM +0000, Uwe Kleine-König wrote:
> > > Uwe Kleine-König commented on a discussion: https://salsa.debian.org/ukleinek/sparse/-/merge_requests/2#note_185155
> > > 
> > > There is still another issue that popped up in the meantime: 
> > > https://bugs.debian.org/966706
> > 
> > Hmmm, I think that a corner of my mind was silently worried it
> > will happen.
> > 
> > > The options are:
> > > 
> > >  - add a Conflicts: biosquid
> > >    (this is the ugliest option)
> > >  - rename sindex to something else
> > >  - convince the bioquid people to rename their sindex
> > >  - stop shipping sindex
> > > 
> > > For now I will go for "stop shipping sindex", do you have an opinion for a long-term plan?
> > 
> > [+CC to sindex's author]
> > 
> > Not really.
> > Would it be easy to install it under the name 'sparse-sindex' or
> > 'sparse-index'?
> > 
> > One thing I would like (in some future release) is to split
> > the sparse package at least in 2:
> > * one with sparse itself
> >   - it has no dependencies (except the libc, a compiler compatible
> >     with gcc and GNU make for the build)
> >   - maybe cgcc should be included in the package too (which would
> >     add a dependency on perl)
> > * one with the others tools
> >   - but maybe it would even be better to the big ones in their
> >     own packages with their own dependencies)
> > But this would not really solve the problem here.
> 
> Renaming of sindex was an option for me, but since you have a plan
> to split the package anyway, then I think it's better to do so. I tried to
> use the libsparse.a and it looks like it works fine [1].
> 
> I spoke with Oleg Nesterov and he also does not mind moving this utility
> to a separate repository.
> 
> [1] https://github.com/legionus/sindex

Oleg pointed out to me that my email is not entirely clear :)

My email does not mean at all that I moved the utility to a separate
repository. I made a proof-of-concept.

Don't get me wrong, I don't mind renaming the utility. This is a good
short term solution but to be honest I don't like the name 'sparse-sindex'
because it is very long. Can we think of something shorter ?

Also, could you tell us more about your plan for future releases ?
How do you plan to split the repository ?

-- 
Rgrds, legion


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
  2020-08-04 16:38           ` Alexey Gladkov
@ 2020-08-04 18:52             ` Oleg Nesterov
  2020-08-04 19:33             ` Luc Van Oostenryck
  2020-08-04 20:02             ` Luc Van Oostenryck
  2 siblings, 0 replies; 14+ messages in thread
From: Oleg Nesterov @ 2020-08-04 18:52 UTC (permalink / raw)
  To: Alexey Gladkov
  Cc: Luc Van Oostenryck, Uwe Kleine-König / sparse, linux-sparse

On 08/04, Alexey Gladkov wrote:
>
> Don't get me wrong, I don't mind renaming the utility. This is a good
> short term solution

I think it would be better to rename it in any case, whatever you and Luc
decide. We do not want the naming conflict, imo.

Just in case, I'd personally prefer to keep sindex in sparse's repository,
but of course I won't argue if you guys decide otherwise.

> but to be honest I don't like the name 'sparse-sindex'
> because it is very long.

me too ;)

> Can we think of something shorter ?

I can't. May be just "dissect" ? But I agree in advance with any name.

Oleg.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
  2020-08-04 16:38           ` Alexey Gladkov
  2020-08-04 18:52             ` Oleg Nesterov
@ 2020-08-04 19:33             ` Luc Van Oostenryck
  2020-08-04 20:02             ` Luc Van Oostenryck
  2 siblings, 0 replies; 14+ messages in thread
From: Luc Van Oostenryck @ 2020-08-04 19:33 UTC (permalink / raw)
  To: Alexey Gladkov
  Cc: Uwe Kleine-König / sparse, linux-sparse, Oleg Nesterov

On Tue, Aug 04, 2020 at 06:38:12PM +0200, Alexey Gladkov wrote:
> On Mon, Aug 03, 2020 at 04:53:10PM +0200, Alexey Gladkov wrote:
> > On Sun, Aug 02, 2020 at 11:30:35PM +0200, Luc Van Oostenryck wrote:
> > > On Sun, Aug 02, 2020 at 08:18:42PM +0000, Uwe Kleine-König wrote:
> > > > Uwe Kleine-König commented on a discussion: https://salsa.debian.org/ukleinek/sparse/-/merge_requests/2#note_185155
> > > > 
> > > > There is still another issue that popped up in the meantime: 
> > > > https://bugs.debian.org/966706
> > > 
> > > Hmmm, I think that a corner of my mind was silently worried it
> > > will happen.
> > > 
> > > > The options are:
> > > > 
> > > >  - add a Conflicts: biosquid
> > > >    (this is the ugliest option)
> > > >  - rename sindex to something else
> > > >  - convince the bioquid people to rename their sindex
> > > >  - stop shipping sindex
> > > > 
> > > > For now I will go for "stop shipping sindex", do you have an opinion for a long-term plan?
> > > 
> > > [+CC to sindex's author]
> > > 
> > > Not really.
> > > Would it be easy to install it under the name 'sparse-sindex' or
> > > 'sparse-index'?
> > > 
> > > One thing I would like (in some future release) is to split
> > > the sparse package at least in 2:
> > > * one with sparse itself
> > >   - it has no dependencies (except the libc, a compiler compatible
> > >     with gcc and GNU make for the build)
> > >   - maybe cgcc should be included in the package too (which would
> > >     add a dependency on perl)
> > > * one with the others tools
> > >   - but maybe it would even be better to the big ones in their
> > >     own packages with their own dependencies)
> > > But this would not really solve the problem here.
> > 
> > Renaming of sindex was an option for me, but since you have a plan
> > to split the package anyway, then I think it's better to do so. I tried to
> > use the libsparse.a and it looks like it works fine [1].
> > 
> > I spoke with Oleg Nesterov and he also does not mind moving this utility
> > to a separate repository.
> > 
> > [1] https://github.com/legionus/sindex
> 
> Oleg pointed out to me that my email is not entirely clear :)
> 
> My email does not mean at all that I moved the utility to a separate
> repository. I made a proof-of-concept.
> 
> Don't get me wrong, I don't mind renaming the utility. This is a good
> short term solution but to be honest I don't like the name 'sparse-sindex'
> because it is very long. Can we think of something shorter ?
> 
> Also, could you tell us more about your plan for future releases ?
> How do you plan to split the repository ?

Ah sorry, it's just a misunderstanding. The context of my email wasn't
very clear. But no worries, I have absolutely no intentions to split
the repository (that would be very annoying for everybody). I was only
talking about, maybe, in some future, split the *package* at distro
level. For example, currently Debian has already 2 packages for sparse:
one, called 'sparse', with almost everything, and another one only
with 'test-inspect', called 'sparse-test-inspect'.

In any case, I don't have any precise plan, and distro packaging is
anyway something to be decided by the distros. So, if anything will
done in this direction, it will be done in collaboration of the distros
and anyone involved.

For the name, I'm also don't like 'sparse-sindex', but it would just
have been an easy way to avoid the name conflict in Debian packages
(I understand that no such conflict exist with Fedora because
'biosquid' only exists for Debian).

Best regards,
-- Luc

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
  2020-08-04 16:38           ` Alexey Gladkov
  2020-08-04 18:52             ` Oleg Nesterov
  2020-08-04 19:33             ` Luc Van Oostenryck
@ 2020-08-04 20:02             ` Luc Van Oostenryck
  2020-08-05 10:16               ` Alexey Gladkov
  2 siblings, 1 reply; 14+ messages in thread
From: Luc Van Oostenryck @ 2020-08-04 20:02 UTC (permalink / raw)
  To: Alexey Gladkov
  Cc: Uwe Kleine-König / sparse, linux-sparse, Oleg Nesterov

On Tue, Aug 04, 2020 at 06:38:12PM +0200, Alexey Gladkov wrote:
> Don't get me wrong, I don't mind renaming the utility. This is a good
> short term solution but to be honest I don't like the name 'sparse-sindex'
> because it is very long.

I also think 'sparse-sindex' would be a bad name for anything
but this 'very-short-term-solution-for-this-package'.

> Can we think of something shorter ?

Yes, of course. Propose anything. You're the author of this tool,
as such I consider that you have full moral rights on it, including
its name.  It's really up to you.

Best regards,
-- Luc

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
  2020-08-04 20:02             ` Luc Van Oostenryck
@ 2020-08-05 10:16               ` Alexey Gladkov
  0 siblings, 0 replies; 14+ messages in thread
From: Alexey Gladkov @ 2020-08-05 10:16 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: Uwe Kleine-König / sparse, linux-sparse, Oleg Nesterov

On Tue, Aug 04, 2020 at 10:02:01PM +0200, Luc Van Oostenryck wrote:
> On Tue, Aug 04, 2020 at 06:38:12PM +0200, Alexey Gladkov wrote:
> > Don't get me wrong, I don't mind renaming the utility. This is a good
> > short term solution but to be honest I don't like the name 'sparse-sindex'
> > because it is very long.
> 
> I also think 'sparse-sindex' would be a bad name for anything
> but this 'very-short-term-solution-for-this-package'.
> 
> > Can we think of something shorter ?
> 
> Yes, of course. Propose anything. You're the author of this tool,
> as such I consider that you have full moral rights on it, including
> its name.  It's really up to you.

Oh my ... You are asking to come up with a new name for a person whose
fantasy is the same as that of a stone :)

I like Oleg's idea. Let's call the utility 'dissect' if it's not already
in use.

-- 
Rgrds, legion


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
       [not found]   ` <note_184882@salsa.debian.org>
  2020-08-02 13:29     ` Luc Van Oostenryck
@ 2020-08-09 19:21     ` Luc Van Oostenryck
  1 sibling, 0 replies; 14+ messages in thread
From: Luc Van Oostenryck @ 2020-08-09 19:21 UTC (permalink / raw)
  To: Uwe Kleine-König / sparse; +Cc: linux-sparse, Uwe Kleine-König

I see that sparse v0.6.2 have made it to Debian testing.

Thanks a lot for having made this possible.

-- Luc

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
  2020-08-05 15:44                     ` Alexey Gladkov
@ 2020-08-05 19:58                       ` Luc Van Oostenryck
  0 siblings, 0 replies; 14+ messages in thread
From: Luc Van Oostenryck @ 2020-08-05 19:58 UTC (permalink / raw)
  To: Alexey Gladkov; +Cc: linux-sparse, Uwe Kleine-König

On Wed, Aug 05, 2020 at 05:44:49PM +0200, Alexey Gladkov wrote:
> On Wed, Aug 05, 2020 at 05:20:26PM +0200, Luc Van Oostenryck wrote:
> > 
> > Excellent.
> > Can I apply the attached patch with your signoff and you as author?
> 
> Sure.

Thanks. I just pushed it upstream.

-- Luc 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
  2020-08-05 15:20                   ` Luc Van Oostenryck
@ 2020-08-05 15:44                     ` Alexey Gladkov
  2020-08-05 19:58                       ` Luc Van Oostenryck
  0 siblings, 1 reply; 14+ messages in thread
From: Alexey Gladkov @ 2020-08-05 15:44 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse, Uwe Kleine-König

On Wed, Aug 05, 2020 at 05:20:26PM +0200, Luc Van Oostenryck wrote:
> On Wed, Aug 05, 2020 at 01:21:41PM +0200, Alexey Gladkov wrote:
> > On Wed, Aug 05, 2020 at 01:04:18PM +0200, Luc Van Oostenryck wrote:
> > > On Wed, Aug 05, 2020 at 10:37:21AM +0000, Uwe Kleine-König wrote:
> > > > 
> > > > `dissect` seems to be fine, there is only `/lib/systemd/systemd-dissect` in Debian.
> > > > 
> > > > Alternatives that come to my mind are: `sein` (which is German for "be") or `semind` (which sounds a bit like "the mind").
> > > > If there were a mode to emit a tag file (as `ctags` and `etags` do) to be used in an editor, also `stags` is funny.
> > 
> > It looks like a feature request :)
> > 
> > > > 
> > > > All of them seem to be free to be used.
> > 
> > I like 'semind'.
> 
> Excellent.
> Can I apply the attached patch with your signoff and you as author?

Sure.

> -- Luc

> From af1f245feffd2a3a299fad6489dad76066604002 Mon Sep 17 00:00:00 2001
> From: Alexey Gladkov <gladkov.alexey@gmail.com>
> Date: Wed, 5 Aug 2020 17:00:21 +0200
> Subject: [PATCH] sindex: rename it to 'semind'
> 
> The name 'sindex' is already used by another package (biosquid).
> 
> So it was decided to rename it to 'semind'.
> 
> ---
>  .gitignore           |   2 +-
>  Makefile             |  14 +-
>  sindex.1 => semind.1 |  18 +--
>  sindex.c => semind.c | 356 +++++++++++++++++++++----------------------
>  4 files changed, 195 insertions(+), 195 deletions(-)
>  rename sindex.1 => semind.1 (91%)
>  rename sindex.c => semind.c (72%)
> 
> diff --git a/.gitignore b/.gitignore
> index 58598364aac5..63c74afdb156 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -19,7 +19,7 @@ graph
>  obfuscate
>  sparse
>  sparse-llvm
> -sindex
> +semind
>  test-dissect
>  test-inspect
>  test-lexing
> diff --git a/Makefile b/Makefile
> index fea2d74ff59a..639d4f518b7a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -157,17 +157,17 @@ ifeq ($(HAVE_SQLITE),yes)
>  SQLITE_VERSION:=$(shell $(PKG_CONFIG) --modversion sqlite3)
>  SQLITE_VNUMBER:=$(shell printf '%d%02d%02d' $(subst ., ,$(SQLITE_VERSION)))
>  ifeq ($(shell expr "$(SQLITE_VNUMBER)" '>=' 32400),1)
> -PROGRAMS += sindex
> -INST_PROGRAMS += sindex
> -INST_MAN1 += sindex.1
> -sindex-ldlibs := $(shell $(PKG_CONFIG) --libs sqlite3)
> -sindex-cflags := $(shell $(PKG_CONFIG) --cflags sqlite3)
> -sindex-cflags += -std=gnu99
> +PROGRAMS += semind
> +INST_PROGRAMS += semind
> +INST_MAN1 += semind.1
> +semind-ldlibs := $(shell $(PKG_CONFIG) --libs sqlite3)
> +semind-cflags := $(shell $(PKG_CONFIG) --cflags sqlite3)
> +semind-cflags += -std=gnu99
>  else
>  $(warning Your SQLite3 version ($(SQLITE_VERSION)) is too old, 3.24.0 or later is required.)
>  endif
>  else
> -$(warning Your system does not have sqlite3, disabling sindex)
> +$(warning Your system does not have sqlite3, disabling semind)
>  endif
>  
>  # Can we use gtk (needed for test-inspect)
> diff --git a/sindex.1 b/semind.1
> similarity index 91%
> rename from sindex.1
> rename to semind.1
> index 06b0bcff3cd0..44e79346644d 100644
> --- a/sindex.1
> +++ b/semind.1
> @@ -1,27 +1,27 @@
>  .\" Sindex manpage by Alexey Gladkov
> -.TH sindex "1"
> +.TH semind "1"
>  .
>  .SH NAME
> -sindex \- Semantic Indexer for C
> +semind \- Semantic Indexer for C
>  .
>  .SH SYNOPSIS
> -.B sindex
> +.B semind
>  [\fIoptions\fR]
>  .br
> -.B sindex
> +.B semind
>  [\fIoptions\fR] \fIadd\fR [\fIcommand options\fR] [\fI--\fR] [\fIcompiler options\fR] [\fIfiles...\fR]
>  .br
> -.B sindex
> +.B semind
>  [\fIoptions\fR] \fIrm\fR [\fIcommand options\fR] \fIpattern\fR
>  .br
> -.B sindex
> +.B semind
>  [\fIoptions\fR] \fIsearch\fR [\fIcommand options\fR] [\fIpattern\fR]
>  .br
> -.B sindex [\fIoptions\fR] \fIsearch\fR [\fIcommand options\fR] (\fI-e\fR|\fI-l\fR) \fIfilename\fR:\fIlinenr\fR:\fIcolumn\fR
> +.B semind [\fIoptions\fR] \fIsearch\fR [\fIcommand options\fR] (\fI-e\fR|\fI-l\fR) \fIfilename\fR:\fIlinenr\fR:\fIcolumn\fR
>  .br
>  .SH DESCRIPTION
>  .P
> -sindex is the simple to use cscope-like tool based on sparse/dissect.  Unlike
> +semind is the simple to use cscope-like tool based on sparse/dissect.  Unlike
>  cscope it runs after pre-processor and thus it can't index the code filtered out
>  by ifdef's, but otoh it understands how the symbol is used and it can track the
>  usage of struct members.
> @@ -44,7 +44,7 @@ wildcard pattern.
>  .SH COMMON OPTIONS
>  .TP
>  \fB-D\fR, \fB--database=FILE\fR
> -specify database file (default: ./sindex.sqlite).
> +specify database file (default: ./semind.sqlite).
>  .TP
>  \fB-v\fR, \fB--verbose\fR
>  show information about what is being done.
> diff --git a/sindex.c b/semind.c
> similarity index 72%
> rename from sindex.c
> rename to semind.c
> index bff6d8c4df84..911fc7470a30 100644
> --- a/sindex.c
> +++ b/semind.c
> @@ -1,5 +1,5 @@
>  /*
> - * sindex - semantic indexer for C.
> + * semind - semantic indexer for C.
>   *
>   * Copyright (C) 2020  Alexey Gladkov
>   */
> @@ -23,44 +23,44 @@
>  #define U_DEF (0x100 << U_SHIFT)
>  #define SINDEX_DATABASE_VERSION 1
>  
> -#define message(fmt, ...) sindex_error(0, 0, (fmt), ##__VA_ARGS__)
> +#define message(fmt, ...) semind_error(0, 0, (fmt), ##__VA_ARGS__)
>  
>  static const char *progname;
> -static const char *sindex_command = NULL;
> +static const char *semind_command = NULL;
>  
>  // common options
> -static const char *sindex_dbfile = "sindex.sqlite";
> -static int sindex_verbose = 0;
> +static const char *semind_dbfile = "semind.sqlite";
> +static int semind_verbose = 0;
>  static char cwd[PATH_MAX];
>  static size_t n_cwd;
>  
>  // 'add' command options
> -static struct string_list *sindex_filelist = NULL;
> -static int sindex_include_local_syms = 0;
> +static struct string_list *semind_filelist = NULL;
> +static int semind_include_local_syms = 0;
>  
> -struct sindex_streams {
> +struct semind_streams {
>  	sqlite3_int64 id;
>  };
>  
> -static struct sindex_streams *sindex_streams = NULL;
> -static int sindex_streams_nr = 0;
> +static struct semind_streams *semind_streams = NULL;
> +static int semind_streams_nr = 0;
>  
>  // 'search' command options
> -static int sindex_search_modmask;
> -static int sindex_search_modmask_defined = 0;
> -static int sindex_search_kind = 0;
> -static char *sindex_search_path = NULL;
> -static char *sindex_search_symbol = NULL;
> -static const char *sindex_search_format = "(%m) %f\t%l\t%c\t%C\t%s";
> +static int semind_search_modmask;
> +static int semind_search_modmask_defined = 0;
> +static int semind_search_kind = 0;
> +static char *semind_search_path = NULL;
> +static char *semind_search_symbol = NULL;
> +static const char *semind_search_format = "(%m) %f\t%l\t%c\t%C\t%s";
>  
>  #define EXPLAIN_LOCATION 1
>  #define USAGE_BY_LOCATION 2
> -static int sindex_search_by_location;
> -static char *sindex_search_filename;
> -static int sindex_search_line;
> -static int sindex_search_column;
> +static int semind_search_by_location;
> +static char *semind_search_filename;
> +static int semind_search_line;
> +static int semind_search_column;
>  
> -static sqlite3 *sindex_db = NULL;
> +static sqlite3 *semind_db = NULL;
>  static sqlite3_stmt *lock_stmt = NULL;
>  static sqlite3_stmt *unlock_stmt = NULL;
>  static sqlite3_stmt *insert_rec_stmt = NULL;
> @@ -77,9 +77,9 @@ struct command {
>  
>  static void show_usage(void)
>  {
> -	if (sindex_command)
> +	if (semind_command)
>  		printf("Try '%s %s --help' for more information.\n",
> -		       progname, sindex_command);
> +		       progname, semind_command);
>  	else
>  		printf("Try '%s --help' for more information.\n",
>  		       progname);
> @@ -111,7 +111,7 @@ static void show_help(int ret)
>  	    "\n"
>  	    "Report bugs to authors.\n"
>  	    "\n",
> -	    progname, sindex_dbfile);
> +	    progname, semind_dbfile);
>  	exit(ret);
>  }
>  
> @@ -179,17 +179,17 @@ static void show_help_search(int ret)
>  	exit(ret);
>  }
>  
> -static void sindex_print_progname(void)
> +static void semind_print_progname(void)
>  {
>  	fprintf(stderr, "%s: ", progname);
> -	if (sindex_command)
> -		fprintf(stderr, "%s: ", sindex_command);
> +	if (semind_command)
> +		fprintf(stderr, "%s: ", semind_command);
>  }
>  
> -static void sindex_error(int status, int errnum, const char *fmt, ...)
> +static void semind_error(int status, int errnum, const char *fmt, ...)
>  {
>  	va_list ap;
> -	sindex_print_progname();
> +	semind_print_progname();
>  
>  	va_start(ap, fmt);
>  	vfprintf(stderr, fmt, ap);
> @@ -209,10 +209,10 @@ static void set_search_modmask(const char *v)
>  	size_t n = strlen(v);
>  
>  	if (n != 1 && n != 3)
> -		sindex_error(1, 0, "the length of mode value must be 1 or 3: %s", v);
> +		semind_error(1, 0, "the length of mode value must be 1 or 3: %s", v);
>  
> -	sindex_search_modmask_defined = 1;
> -	sindex_search_modmask = 0;
> +	semind_search_modmask_defined = 1;
> +	semind_search_modmask = 0;
>  
>  	if (n == 1) {
>  		switch (v[0]) {
> @@ -220,10 +220,10 @@ static void set_search_modmask(const char *v)
>  			case 'w': v = "ww-"; break;
>  			case 'm': v = "mmm"; break;
>  			case '-': v = "---"; break;
> -			default: sindex_error(1, 0, "unknown modificator: %s", v);
> +			default: semind_error(1, 0, "unknown modificator: %s", v);
>  		}
>  	} else if (!strcmp(v, "def")) {
> -		sindex_search_modmask = U_DEF;
> +		semind_search_modmask = U_DEF;
>  		return;
>  	}
>  
> @@ -235,11 +235,11 @@ static void set_search_modmask(const char *v)
>  
>  	for (int i = 0; i < 3; i++) {
>  		switch (v[i]) {
> -			case 'r': sindex_search_modmask |= modes[i * 3];     break;
> -			case 'w': sindex_search_modmask |= modes[i * 3 + 1]; break;
> -			case 'm': sindex_search_modmask |= modes[i * 3 + 2]; break;
> +			case 'r': semind_search_modmask |= modes[i * 3];     break;
> +			case 'w': semind_search_modmask |= modes[i * 3 + 1]; break;
> +			case 'm': semind_search_modmask |= modes[i * 3 + 2]; break;
>  			case '-': break;
> -			default:  sindex_error(1, 0,
> +			default:  semind_error(1, 0,
>  			                "unknown modificator in the mode value"
>  			                " (`r', `w', `m' or `-' expected): %c", v[i]);
>  		}
> @@ -260,18 +260,18 @@ static void parse_cmdline(int argc, char **argv)
>  	char *env;
>  
>  	if ((env = getenv("SINDEX_DATABASE")) != NULL)
> -		sindex_dbfile = env;
> +		semind_dbfile = env;
>  
>  	while ((c = getopt_long(argc, argv, "+B:D:vh", long_options, NULL)) != -1) {
>  		switch (c) {
>  			case 'D':
> -				sindex_dbfile = optarg;
> +				semind_dbfile = optarg;
>  				break;
>  			case 'B':
>  				basedir = optarg;
>  				break;
>  			case 'v':
> -				sindex_verbose++;
> +				semind_verbose++;
>  				break;
>  			case 'h':
>  				show_help(0);
> @@ -285,7 +285,7 @@ static void parse_cmdline(int argc, char **argv)
>  
>  	if (basedir) {
>  		if (!realpath(basedir, cwd))
> -			sindex_error(1, errno, "unable to get project base directory");
> +			semind_error(1, errno, "unable to get project base directory");
>  		n_cwd = strlen(cwd);
>  	}
>  }
> @@ -305,10 +305,10 @@ static void parse_cmdline_add(int argc, char **argv)
>  	while ((c = getopt_long(argc, argv, "+vh", long_options, NULL)) != -1) {
>  		switch (c) {
>  			case 1:
> -				sindex_include_local_syms = 1;
> +				semind_include_local_syms = 1;
>  				break;
>  			case 'v':
> -				sindex_verbose++;
> +				semind_verbose++;
>  				break;
>  			case 'h':
>  				show_help_add(0);
> @@ -328,7 +328,7 @@ done:
>  	// step back since sparse_initialize will ignore argv[0].
>  	optind--;
>  
> -	sparse_initialize(argc - optind, argv + optind, &sindex_filelist);
> +	sparse_initialize(argc - optind, argv + optind, &semind_filelist);
>  }
>  
>  static void parse_cmdline_rm(int argc, char **argv)
> @@ -343,7 +343,7 @@ static void parse_cmdline_rm(int argc, char **argv)
>  	while ((c = getopt_long(argc, argv, "+vh", long_options, NULL)) != -1) {
>  		switch (c) {
>  			case 'v':
> -				sindex_verbose++;
> +				semind_verbose++;
>  				break;
>  			case 'h':
>  				show_help_rm(0);
> @@ -374,36 +374,36 @@ static void parse_cmdline_search(int argc, char **argv)
>  	while ((c = getopt_long(argc, argv, "+ef:m:k:p:lvh", long_options, NULL)) != -1) {
>  		switch (c) {
>  			case 'e':
> -				sindex_search_by_location = EXPLAIN_LOCATION;
> +				semind_search_by_location = EXPLAIN_LOCATION;
>  				break;
>  			case 'l':
> -				sindex_search_by_location = USAGE_BY_LOCATION;
> +				semind_search_by_location = USAGE_BY_LOCATION;
>  				break;
>  			case 'f':
> -				sindex_search_format = optarg;
> +				semind_search_format = optarg;
>  				break;
>  			case 'm':
>  				set_search_modmask(optarg);
>  				break;
>  			case 'k':
> -				sindex_search_kind = tolower(optarg[0]);
> +				semind_search_kind = tolower(optarg[0]);
>  				break;
>  			case 'p':
> -				sindex_search_path = optarg;
> +				semind_search_path = optarg;
>  				break;
>  			case 'v':
> -				sindex_verbose++;
> +				semind_verbose++;
>  				break;
>  			case 'h':
>  				show_help_search(0);
>  		}
>  	}
>  
> -	if (sindex_search_by_location) {
> +	if (semind_search_by_location) {
>  		char *str;
>  
>  		if (optind == argc)
> -			sindex_error(1, 0, "one argument required");
> +			semind_error(1, 0, "one argument required");
>  
>  		str = argv[optind];
>  
> @@ -414,18 +414,18 @@ static void parse_cmdline_search(int argc, char **argv)
>  				*ptr++ = '\0';
>  
>  			if (*str != '\0') {
> -				if (!sindex_search_filename) {
> -					sindex_search_filename = str;
> -				} else if (!sindex_search_line) {
> -					sindex_search_line = atoi(str);
> -				} else if (!sindex_search_column) {
> -					sindex_search_column = atoi(str);
> +				if (!semind_search_filename) {
> +					semind_search_filename = str;
> +				} else if (!semind_search_line) {
> +					semind_search_line = atoi(str);
> +				} else if (!semind_search_column) {
> +					semind_search_column = atoi(str);
>  				}
>  			}
>  			str = ptr;
>  		}
>  	} else if (optind < argc)
> -		sindex_search_symbol = argv[optind++];
> +		semind_search_symbol = argv[optind++];
>  }
>  
>  static int query_appendf(sqlite3_str *query, const char *fmt, ...)
> @@ -452,22 +452,22 @@ static int query_appendf(sqlite3_str *query, const char *fmt, ...)
>  static inline void sqlite_bind_text(sqlite3_stmt *stmt, const char *field, const char *var, int len)
>  {
>  	if (sqlite3_bind_text(stmt, sqlite3_bind_parameter_index(stmt, field), var, len, SQLITE_STATIC) != SQLITE_OK)
> -		sindex_error(1, 0, "unable to bind value for %s: %s", field, sqlite3_errmsg(sindex_db));
> +		semind_error(1, 0, "unable to bind value for %s: %s", field, sqlite3_errmsg(semind_db));
>  }
>  
>  static inline void sqlite_bind_int64(sqlite3_stmt *stmt, const char *field, long long var)
>  {
>  	if (sqlite3_bind_int64(stmt, sqlite3_bind_parameter_index(stmt, field), var) != SQLITE_OK)
> -		sindex_error(1, 0, "unable to bind value for %s: %s", field, sqlite3_errmsg(sindex_db));
> +		semind_error(1, 0, "unable to bind value for %s: %s", field, sqlite3_errmsg(semind_db));
>  }
>  
>  static inline void sqlite_prepare(const char *sql, sqlite3_stmt **stmt)
>  {
>  	int ret;
>  	do {
> -		ret = sqlite3_prepare_v2(sindex_db, sql, -1, stmt, NULL);
> +		ret = sqlite3_prepare_v2(semind_db, sql, -1, stmt, NULL);
>  		if (ret != SQLITE_OK && ret != SQLITE_BUSY)
> -			sindex_error(1, 0, "unable to prepare query: %s: %s", sqlite3_errmsg(sindex_db), sql);
> +			semind_error(1, 0, "unable to prepare query: %s: %s", sqlite3_errmsg(semind_db), sql);
>  	} while (ret == SQLITE_BUSY);
>  }
>  
> @@ -475,9 +475,9 @@ static inline void sqlite_prepare_persistent(const char *sql, sqlite3_stmt **stm
>  {
>  	int ret;
>  	do {
> -		ret = sqlite3_prepare_v3(sindex_db, sql, -1, SQLITE_PREPARE_PERSISTENT, stmt, NULL);
> +		ret = sqlite3_prepare_v3(semind_db, sql, -1, SQLITE_PREPARE_PERSISTENT, stmt, NULL);
>  		if (ret != SQLITE_OK && ret != SQLITE_BUSY)
> -			sindex_error(1, 0, "unable to prepare query: %s: %s", sqlite3_errmsg(sindex_db), sql);
> +			semind_error(1, 0, "unable to prepare query: %s: %s", sqlite3_errmsg(semind_db), sql);
>  	} while (ret == SQLITE_BUSY);
>  }
>  
> @@ -494,7 +494,7 @@ static int sqlite_run(sqlite3_stmt *stmt)
>  {
>  	int ret = sqlite3_step(stmt);
>  	if (ret != SQLITE_DONE && ret != SQLITE_ROW)
> -		sindex_error(1, 0, "unable to process query: %s: %s", sqlite3_errmsg(sindex_db), sqlite3_sql(stmt));
> +		semind_error(1, 0, "unable to process query: %s: %s", sqlite3_errmsg(semind_db), sqlite3_sql(stmt));
>  	return ret;
>  }
>  
> @@ -522,7 +522,7 @@ static sqlite3_int64 get_db_version(void)
>  static void set_db_version(void)
>  {
>  	char *sql;
> -	sqlite3_str *query = sqlite3_str_new(sindex_db);
> +	sqlite3_str *query = sqlite3_str_new(semind_db);
>  
>  	if (query_appendf(query, "PRAGMA user_version = %d", SINDEX_DATABASE_VERSION) < 0)
>  		exit(1);
> @@ -536,7 +536,7 @@ static void open_temp_database(void)
>  {
>  	static const char *database_schema[] = {
>  		"ATTACH ':memory:' AS tempdb",
> -		"CREATE TABLE tempdb.sindex ("
> +		"CREATE TABLE tempdb.semind ("
>  			" file INTEGER NOT NULL,"
>  			" line INTEGER NOT NULL,"
>  			" column INTEGER NOT NULL,"
> @@ -560,7 +560,7 @@ static void open_database(const char *filename, int flags)
>  			" name TEXT UNIQUE NOT NULL,"
>  			" mtime INTEGER NOT NULL"
>  		")",
> -		"CREATE TABLE sindex ("
> +		"CREATE TABLE semind ("
>  			" file INTEGER NOT NULL REFERENCES file(id) ON DELETE CASCADE,"
>  			" line INTEGER NOT NULL,"
>  			" column INTEGER NOT NULL,"
> @@ -569,15 +569,15 @@ static void open_database(const char *filename, int flags)
>  			" context TEXT,"
>  			" mode INTEGER NOT NULL"
>  		")",
> -		"CREATE UNIQUE INDEX sindex_0 ON sindex (symbol, kind, mode, file, line, column)",
> -		"CREATE INDEX sindex_1 ON sindex (file)",
> +		"CREATE UNIQUE INDEX semind_0 ON semind (symbol, kind, mode, file, line, column)",
> +		"CREATE INDEX semind_1 ON semind (file)",
>  		NULL,
>  	};
>  
>  	int exists = !access(filename, R_OK);
>  
> -	if (sqlite3_open_v2(filename, &sindex_db, flags, NULL) != SQLITE_OK)
> -		sindex_error(1, 0, "unable to open database: %s: %s", filename, sqlite3_errmsg(sindex_db));
> +	if (sqlite3_open_v2(filename, &semind_db, flags, NULL) != SQLITE_OK)
> +		semind_error(1, 0, "unable to open database: %s: %s", filename, sqlite3_errmsg(semind_db));
>  
>  	sqlite_command("PRAGMA journal_mode = WAL");
>  	sqlite_command("PRAGMA synchronous = OFF");
> @@ -587,7 +587,7 @@ static void open_database(const char *filename, int flags)
>  
>  	if (exists) {
>  		if (get_db_version() < SINDEX_DATABASE_VERSION)
> -			sindex_error(1, 0, "%s: Database too old. Please rebuild it.", filename);
> +			semind_error(1, 0, "%s: Database too old. Please rebuild it.", filename);
>  		return;
>  	}
>  
> @@ -627,16 +627,16 @@ static void insert_record(struct index_record *rec)
>  
>  static void update_stream(void)
>  {
> -	if (sindex_streams_nr >= input_stream_nr)
> +	if (semind_streams_nr >= input_stream_nr)
>  		return;
>  
> -	sindex_streams = realloc(sindex_streams, input_stream_nr * sizeof(struct sindex_streams));
> -	if (!sindex_streams)
> -		sindex_error(1, errno, "realloc");
> +	semind_streams = realloc(semind_streams, input_stream_nr * sizeof(struct semind_streams));
> +	if (!semind_streams)
> +		semind_error(1, errno, "realloc");
>  
>  	sqlite_run(lock_stmt);
>  
> -	for (int i = sindex_streams_nr; i < input_stream_nr; i++) {
> +	for (int i = semind_streams_nr; i < input_stream_nr; i++) {
>  		struct stat st;
>  		const char *filename;
>  		char fullname[PATH_MAX];
> @@ -647,26 +647,26 @@ static void update_stream(void)
>  			 * FIXME: Files in the input_streams may be duplicated.
>  			 */
>  			if (stat(input_streams[i].name, &st) < 0)
> -				sindex_error(1, errno, "stat: %s", input_streams[i].name);
> +				semind_error(1, errno, "stat: %s", input_streams[i].name);
>  
>  			cur_mtime = st.st_mtime;
>  
>  			if (!realpath(input_streams[i].name, fullname))
> -				sindex_error(1, errno, "realpath: %s", input_streams[i].name);
> +				semind_error(1, errno, "realpath: %s", input_streams[i].name);
>  
>  			if (!strncmp(fullname, cwd, n_cwd) && fullname[n_cwd] == '/') {
>  				filename = fullname + n_cwd + 1;
> -				sindex_streams[i].id = 0;
> +				semind_streams[i].id = 0;
>  			} else {
> -				sindex_streams[i].id = -1;
> +				semind_streams[i].id = -1;
>  				continue;
>  			}
>  		} else {
> -			sindex_streams[i].id = -1;
> +			semind_streams[i].id = -1;
>  			continue;
>  		}
>  
> -		if (sindex_verbose > 1)
> +		if (semind_verbose > 1)
>  			message("filename: %s", filename);
>  
>  		sqlite_bind_text(select_file_stmt, "@name", filename, -1);
> @@ -674,7 +674,7 @@ static void update_stream(void)
>  		if (sqlite_run(select_file_stmt) == SQLITE_ROW) {
>  			sqlite3_int64 old_mtime;
>  
> -			sindex_streams[i].id = sqlite3_column_int64(select_file_stmt, 0);
> +			semind_streams[i].id = sqlite3_column_int64(select_file_stmt, 0);
>  			old_mtime = sqlite3_column_int64(select_file_stmt, 1);
>  
>  			sqlite_reset_stmt(select_file_stmt);
> @@ -694,12 +694,12 @@ static void update_stream(void)
>  		sqlite_run(insert_file_stmt);
>  		sqlite_reset_stmt(insert_file_stmt);
>  
> -		sindex_streams[i].id = sqlite3_last_insert_rowid(sindex_db);
> +		semind_streams[i].id = sqlite3_last_insert_rowid(semind_db);
>  	}
>  
>  	sqlite_run(unlock_stmt);
>  
> -	sindex_streams_nr = input_stream_nr;
> +	semind_streams_nr = input_stream_nr;
>  }
>  
>  static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym)
> @@ -710,10 +710,10 @@ static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym)
>  
>  	update_stream();
>  
> -	if (sindex_streams[pos->stream].id == -1)
> +	if (semind_streams[pos->stream].id == -1)
>  		return;
>  
> -	if (!sindex_include_local_syms && sym_is_local(sym))
> +	if (!semind_include_local_syms && sym_is_local(sym))
>  		return;
>  
>  	if (!sym->ident) {
> @@ -730,7 +730,7 @@ static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym)
>  	rec.sym_len = sym->ident->len;
>  	rec.kind    = sym->kind;
>  	rec.mode    = mode;
> -	rec.file    = sindex_streams[pos->stream].id;
> +	rec.file    = semind_streams[pos->stream].id;
>  	rec.line    = pos->line;
>  	rec.col     = pos->pos;
>  
> @@ -747,10 +747,10 @@ static void r_member(unsigned mode, struct position *pos, struct symbol *sym, st
>  
>  	update_stream();
>  
> -	if (sindex_streams[pos->stream].id == -1)
> +	if (semind_streams[pos->stream].id == -1)
>  		return;
>  
> -	if (!sindex_include_local_syms && sym_is_local(sym))
> +	if (!semind_include_local_syms && sym_is_local(sym))
>  		return;
>  
>  	ni = built_in_ident("?");
> @@ -769,7 +769,7 @@ static void r_member(unsigned mode, struct position *pos, struct symbol *sym, st
>  	rec.sym_len = si->len + mi->len + 1;
>  	rec.kind    = 'm';
>  	rec.mode    = mode;
> -	rec.file    = sindex_streams[pos->stream].id;
> +	rec.file    = semind_streams[pos->stream].id;
>  	rec.line    = pos->line;
>  	rec.col     = pos->pos;
>  
> @@ -806,7 +806,7 @@ static void command_add(int argc, char **argv)
>  		&unlock_stmt);
>  
>  	sqlite_prepare_persistent(
> -		"INSERT OR IGNORE INTO tempdb.sindex "
> +		"INSERT OR IGNORE INTO tempdb.semind "
>  		"(context, symbol, kind, mode, file, line, column) "
>  		"VALUES (@context, @symbol, @kind, @mode, @file, @line, @column)",
>  		&insert_rec_stmt);
> @@ -823,10 +823,10 @@ static void command_add(int argc, char **argv)
>  		"DELETE FROM file WHERE name == @name",
>  		&delete_file_stmt);
>  
> -	dissect(&reporter, sindex_filelist);
> +	dissect(&reporter, semind_filelist);
>  
>  	sqlite_run(lock_stmt);
> -	sqlite_command("INSERT OR IGNORE INTO sindex SELECT * FROM tempdb.sindex");
> +	sqlite_command("INSERT OR IGNORE INTO semind SELECT * FROM tempdb.semind");
>  	sqlite_run(unlock_stmt);
>  
>  	sqlite3_finalize(insert_rec_stmt);
> @@ -835,7 +835,7 @@ static void command_add(int argc, char **argv)
>  	sqlite3_finalize(delete_file_stmt);
>  	sqlite3_finalize(lock_stmt);
>  	sqlite3_finalize(unlock_stmt);
> -	free(sindex_streams);
> +	free(semind_streams);
>  }
>  
>  static void command_rm(int argc, char **argv)
> @@ -845,7 +845,7 @@ static void command_rm(int argc, char **argv)
>  	sqlite_command("BEGIN IMMEDIATE");
>  	sqlite_prepare("DELETE FROM file WHERE name GLOB @file", &stmt);
>  
> -	if (sindex_verbose > 1)
> +	if (semind_verbose > 1)
>  		message("SQL: %s", sqlite3_sql(stmt));
>  
>  	for (int i = 0; i < argc; i++) {
> @@ -877,12 +877,12 @@ static inline void print_mode(char *value)
>  #undef U
>  }
>  
> -static char *sindex_file_name;
> -static FILE *sindex_file_fd;
> -static int sindex_file_lnum;
> -static char *sindex_line;
> -static size_t sindex_line_buflen;
> -static int sindex_line_len;
> +static char *semind_file_name;
> +static FILE *semind_file_fd;
> +static int semind_file_lnum;
> +static char *semind_line;
> +static size_t semind_line_buflen;
> +static int semind_line_len;
>  
>  static void print_file_line(const char *name, int lnum)
>  {
> @@ -890,43 +890,43 @@ static void print_file_line(const char *name, int lnum)
>  	 * All files are sorted by name and line number. So, we can reopen
>  	 * the file and read it line by line.
>  	 */
> -	if (!sindex_file_name || strcmp(sindex_file_name, name)) {
> -		if (sindex_file_fd) {
> -			fclose(sindex_file_fd);
> -			free(sindex_file_name);
> +	if (!semind_file_name || strcmp(semind_file_name, name)) {
> +		if (semind_file_fd) {
> +			fclose(semind_file_fd);
> +			free(semind_file_name);
>  		}
>  
> -		sindex_file_name = strdup(name);
> +		semind_file_name = strdup(name);
>  
> -		if (!sindex_file_name)
> -			sindex_error(1, errno, "strdup");
> +		if (!semind_file_name)
> +			semind_error(1, errno, "strdup");
>  
> -		sindex_file_fd = fopen(name, "r");
> +		semind_file_fd = fopen(name, "r");
>  
> -		if (!sindex_file_fd)
> -			sindex_error(1, errno, "fopen: %s", name);
> +		if (!semind_file_fd)
> +			semind_error(1, errno, "fopen: %s", name);
>  
> -		sindex_file_lnum = 0;
> +		semind_file_lnum = 0;
>  	}
>  
>  	do {
> -		if (sindex_file_lnum == lnum) {
> -			if (sindex_line[sindex_line_len-1] == '\n')
> -				sindex_line_len--;
> -			printf("%.*s", sindex_line_len, sindex_line);
> +		if (semind_file_lnum == lnum) {
> +			if (semind_line[semind_line_len-1] == '\n')
> +				semind_line_len--;
> +			printf("%.*s", semind_line_len, semind_line);
>  			break;
>  		}
> -		sindex_file_lnum++;
> +		semind_file_lnum++;
>  		errno = 0;
> -	} while((sindex_line_len = getline(&sindex_line, &sindex_line_buflen, sindex_file_fd)) != -1);
> +	} while((semind_line_len = getline(&semind_line, &semind_line_buflen, semind_file_fd)) != -1);
>  
>  	if (errno && errno != EOF)
> -		sindex_error(1, errno, "getline");
> +		semind_error(1, errno, "getline");
>  }
>  
>  static int search_query_callback(void *data, int argc, char **argv, char **colname)
>  {
> -	char *fmt = (char *) sindex_search_format;
> +	char *fmt = (char *) semind_search_format;
>  	char buf[32];
>  	int quote = 0;
>  	int n = 0;
> @@ -948,7 +948,7 @@ static int search_query_callback(void *data, int argc, char **argv, char **colna
>  			c = *fmt;
>  
>  			if (c == '\0')
> -				sindex_error(1, 0, "unexpected end of format string");
> +				semind_error(1, 0, "unexpected end of format string");
>  
>  			switch (c) {
>  				case 'f': colnum = 0; goto print_string;
> @@ -995,7 +995,7 @@ static int search_query_callback(void *data, int argc, char **argv, char **colna
>  			}
>  
>  			if (pos == fmt)
> -				sindex_error(1, 0, "invalid format specification: %%%c", c);
> +				semind_error(1, 0, "invalid format specification: %%%c", c);
>  
>  			continue;
>  		} else if (c == '\\') {
> @@ -1024,104 +1024,104 @@ static void command_search(int argc, char **argv)
>  {
>  	char *sql;
>  	char *dberr = NULL;
> -	sqlite3_str *query = sqlite3_str_new(sindex_db);
> +	sqlite3_str *query = sqlite3_str_new(semind_db);
>  
>  	if (chdir(cwd) < 0)
> -		sindex_error(1, errno, "unable to change directory: %s", cwd);
> +		semind_error(1, errno, "unable to change directory: %s", cwd);
>  
>  	if (query_appendf(query,
>  	                  "SELECT"
>  	                  " file.name,"
> -	                  " sindex.line,"
> -	                  " sindex.column,"
> -	                  " sindex.context,"
> -	                  " sindex.symbol,"
> -	                  " sindex.mode,"
> -	                  " sindex.kind "
> -	                  "FROM sindex, file "
> -	                  "WHERE sindex.file == file.id") < 0)
> +	                  " semind.line,"
> +	                  " semind.column,"
> +	                  " semind.context,"
> +	                  " semind.symbol,"
> +	                  " semind.mode,"
> +	                  " semind.kind "
> +	                  "FROM semind, file "
> +	                  "WHERE semind.file == file.id") < 0)
>  		goto fail;
>  
> -	if (sindex_search_kind) {
> -		if (query_appendf(query, " AND sindex.kind == %d", sindex_search_kind) < 0)
> +	if (semind_search_kind) {
> +		if (query_appendf(query, " AND semind.kind == %d", semind_search_kind) < 0)
>  			goto fail;
>  	}
>  
> -	if (sindex_search_symbol) {
> +	if (semind_search_symbol) {
>  		int ret;
>  
>  		if (query_appendf(query, " AND ") < 0)
>  			goto fail;
>  
> -		if (strpbrk(sindex_search_symbol, "*?[]"))
> -			ret = query_appendf(query, "sindex.symbol GLOB %Q", sindex_search_symbol);
> +		if (strpbrk(semind_search_symbol, "*?[]"))
> +			ret = query_appendf(query, "semind.symbol GLOB %Q", semind_search_symbol);
>  		else
> -			ret = query_appendf(query, "sindex.symbol == %Q", sindex_search_symbol);
> +			ret = query_appendf(query, "semind.symbol == %Q", semind_search_symbol);
>  
>  		if (ret < 0)
>  			goto fail;
>  	}
>  
> -	if (sindex_search_modmask_defined) {
> -		if (!sindex_search_modmask) {
> -			if (query_appendf(query, " AND sindex.mode == %d", sindex_search_modmask) < 0)
> +	if (semind_search_modmask_defined) {
> +		if (!semind_search_modmask) {
> +			if (query_appendf(query, " AND semind.mode == %d", semind_search_modmask) < 0)
>  				goto fail;
> -		} else if (query_appendf(query, " AND (sindex.mode & %d) != 0", sindex_search_modmask) < 0)
> +		} else if (query_appendf(query, " AND (semind.mode & %d) != 0", semind_search_modmask) < 0)
>  			goto fail;
>  	}
>  
> -	if (sindex_search_path) {
> -		if (query_appendf(query, " AND file.name GLOB %Q", sindex_search_path) < 0)
> +	if (semind_search_path) {
> +		if (query_appendf(query, " AND file.name GLOB %Q", semind_search_path) < 0)
>  			goto fail;
>  	}
>  
> -	if (sindex_search_by_location == EXPLAIN_LOCATION) {
> -		if (query_appendf(query, " AND file.name == %Q", sindex_search_filename) < 0)
> +	if (semind_search_by_location == EXPLAIN_LOCATION) {
> +		if (query_appendf(query, " AND file.name == %Q", semind_search_filename) < 0)
>  			goto fail;
> -		if (sindex_search_line &&
> -		    query_appendf(query, " AND sindex.line == %d", sindex_search_line) < 0)
> +		if (semind_search_line &&
> +		    query_appendf(query, " AND semind.line == %d", semind_search_line) < 0)
>  			goto fail;
> -		if (sindex_search_column &&
> -		    query_appendf(query, " AND sindex.column == %d", sindex_search_column) < 0)
> +		if (semind_search_column &&
> +		    query_appendf(query, " AND semind.column == %d", semind_search_column) < 0)
>  			goto fail;
> -	} else if (sindex_search_by_location == USAGE_BY_LOCATION) {
> -		if (query_appendf(query, " AND sindex.symbol IN (") < 0)
> +	} else if (semind_search_by_location == USAGE_BY_LOCATION) {
> +		if (query_appendf(query, " AND semind.symbol IN (") < 0)
>  			goto fail;
>  		if (query_appendf(query,
> -		                 "SELECT sindex.symbol FROM sindex, file WHERE"
> -				 " sindex.file == file.id AND"
> -		                 " file.name == %Q", sindex_search_filename) < 0)
> +		                 "SELECT semind.symbol FROM semind, file WHERE"
> +				 " semind.file == file.id AND"
> +		                 " file.name == %Q", semind_search_filename) < 0)
>  			goto fail;
> -		if (sindex_search_line &&
> -		    query_appendf(query, " AND sindex.line == %d", sindex_search_line) < 0)
> +		if (semind_search_line &&
> +		    query_appendf(query, " AND semind.line == %d", semind_search_line) < 0)
>  			goto fail;
> -		if (sindex_search_column &&
> -		    query_appendf(query, " AND sindex.column == %d", sindex_search_column) < 0)
> +		if (semind_search_column &&
> +		    query_appendf(query, " AND semind.column == %d", semind_search_column) < 0)
>  			goto fail;
>  		if (query_appendf(query, ")") < 0)
>  			goto fail;
>  	}
>  
> -	if (query_appendf(query, " ORDER BY file.name, sindex.line, sindex.column ASC", sindex_search_path) < 0)
> +	if (query_appendf(query, " ORDER BY file.name, semind.line, semind.column ASC", semind_search_path) < 0)
>  		goto fail;
>  
>  	sql = sqlite3_str_value(query);
>  
> -	if (sindex_verbose > 1)
> +	if (semind_verbose > 1)
>  		message("SQL: %s", sql);
>  
> -	sqlite3_exec(sindex_db, sql, search_query_callback, NULL, &dberr);
> +	sqlite3_exec(semind_db, sql, search_query_callback, NULL, &dberr);
>  	if (dberr)
> -		sindex_error(1, 0, "sql query failed: %s", dberr);
> +		semind_error(1, 0, "sql query failed: %s", dberr);
>  fail:
>  	sql = sqlite3_str_finish(query);
>  	sqlite3_free(sql);
>  
> -	if (sindex_file_fd) {
> -		fclose(sindex_file_fd);
> -		free(sindex_file_name);
> +	if (semind_file_fd) {
> +		fclose(semind_file_fd);
> +		free(semind_file_name);
>  	}
> -	free(sindex_line);
> +	free(semind_line);
>  }
>  
>  
> @@ -1156,25 +1156,25 @@ int main(int argc, char **argv)
>  		progname++;
>  
>  	if (!realpath(".", cwd))
> -		sindex_error(1, errno, "unable to get current directory");
> +		semind_error(1, errno, "unable to get current directory");
>  	n_cwd = strlen(cwd);
>  
>  	parse_cmdline(argc, argv);
>  
>  	for (cmd = commands; cmd->name && strcmp(argv[optind], cmd->name); cmd++);
>  	if (!cmd->name)
> -		sindex_error(1, 0, "unknown command: %s", argv[optind]);
> +		semind_error(1, 0, "unknown command: %s", argv[optind]);
>  	optind++;
>  
> -	sindex_command = cmd->name;
> +	semind_command = cmd->name;
>  
>  	if (cmd->parse_cmdline)
>  		cmd->parse_cmdline(argc, argv);
>  
> -	open_database(sindex_dbfile, cmd->dbflags);
> +	open_database(semind_dbfile, cmd->dbflags);
>  	cmd->handler(argc - optind, argv + optind);
>  
> -	sqlite3_close(sindex_db);
> +	sqlite3_close(semind_db);
>  
>  	return 0;
>  }
> -- 
> 2.28.0
> 


-- 
Rgrds, legion


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: sparse | upgrade to upstream v0.6.2 (!2)
       [not found]                 ` <20200805112141.ier2xkhm5sqjtbck@comp-core-i7-2640m-0182e6>
@ 2020-08-05 15:20                   ` Luc Van Oostenryck
  2020-08-05 15:44                     ` Alexey Gladkov
  0 siblings, 1 reply; 14+ messages in thread
From: Luc Van Oostenryck @ 2020-08-05 15:20 UTC (permalink / raw)
  To: Alexey Gladkov; +Cc: linux-sparse, Uwe Kleine-König

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]

On Wed, Aug 05, 2020 at 01:21:41PM +0200, Alexey Gladkov wrote:
> On Wed, Aug 05, 2020 at 01:04:18PM +0200, Luc Van Oostenryck wrote:
> > On Wed, Aug 05, 2020 at 10:37:21AM +0000, Uwe Kleine-König wrote:
> > > 
> > > `dissect` seems to be fine, there is only `/lib/systemd/systemd-dissect` in Debian.
> > > 
> > > Alternatives that come to my mind are: `sein` (which is German for "be") or `semind` (which sounds a bit like "the mind").
> > > If there were a mode to emit a tag file (as `ctags` and `etags` do) to be used in an editor, also `stags` is funny.
> 
> It looks like a feature request :)
> 
> > > 
> > > All of them seem to be free to be used.
> 
> I like 'semind'.

Excellent.
Can I apply the attached patch with your signoff and you as author?

-- Luc

[-- Attachment #2: 0001-sindex-rename-it-to-semind.patch --]
[-- Type: text/plain, Size: 31660 bytes --]

From af1f245feffd2a3a299fad6489dad76066604002 Mon Sep 17 00:00:00 2001
From: Alexey Gladkov <gladkov.alexey@gmail.com>
Date: Wed, 5 Aug 2020 17:00:21 +0200
Subject: [PATCH] sindex: rename it to 'semind'

The name 'sindex' is already used by another package (biosquid).

So it was decided to rename it to 'semind'.

---
 .gitignore           |   2 +-
 Makefile             |  14 +-
 sindex.1 => semind.1 |  18 +--
 sindex.c => semind.c | 356 +++++++++++++++++++++----------------------
 4 files changed, 195 insertions(+), 195 deletions(-)
 rename sindex.1 => semind.1 (91%)
 rename sindex.c => semind.c (72%)

diff --git a/.gitignore b/.gitignore
index 58598364aac5..63c74afdb156 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,7 +19,7 @@ graph
 obfuscate
 sparse
 sparse-llvm
-sindex
+semind
 test-dissect
 test-inspect
 test-lexing
diff --git a/Makefile b/Makefile
index fea2d74ff59a..639d4f518b7a 100644
--- a/Makefile
+++ b/Makefile
@@ -157,17 +157,17 @@ ifeq ($(HAVE_SQLITE),yes)
 SQLITE_VERSION:=$(shell $(PKG_CONFIG) --modversion sqlite3)
 SQLITE_VNUMBER:=$(shell printf '%d%02d%02d' $(subst ., ,$(SQLITE_VERSION)))
 ifeq ($(shell expr "$(SQLITE_VNUMBER)" '>=' 32400),1)
-PROGRAMS += sindex
-INST_PROGRAMS += sindex
-INST_MAN1 += sindex.1
-sindex-ldlibs := $(shell $(PKG_CONFIG) --libs sqlite3)
-sindex-cflags := $(shell $(PKG_CONFIG) --cflags sqlite3)
-sindex-cflags += -std=gnu99
+PROGRAMS += semind
+INST_PROGRAMS += semind
+INST_MAN1 += semind.1
+semind-ldlibs := $(shell $(PKG_CONFIG) --libs sqlite3)
+semind-cflags := $(shell $(PKG_CONFIG) --cflags sqlite3)
+semind-cflags += -std=gnu99
 else
 $(warning Your SQLite3 version ($(SQLITE_VERSION)) is too old, 3.24.0 or later is required.)
 endif
 else
-$(warning Your system does not have sqlite3, disabling sindex)
+$(warning Your system does not have sqlite3, disabling semind)
 endif
 
 # Can we use gtk (needed for test-inspect)
diff --git a/sindex.1 b/semind.1
similarity index 91%
rename from sindex.1
rename to semind.1
index 06b0bcff3cd0..44e79346644d 100644
--- a/sindex.1
+++ b/semind.1
@@ -1,27 +1,27 @@
 .\" Sindex manpage by Alexey Gladkov
-.TH sindex "1"
+.TH semind "1"
 .
 .SH NAME
-sindex \- Semantic Indexer for C
+semind \- Semantic Indexer for C
 .
 .SH SYNOPSIS
-.B sindex
+.B semind
 [\fIoptions\fR]
 .br
-.B sindex
+.B semind
 [\fIoptions\fR] \fIadd\fR [\fIcommand options\fR] [\fI--\fR] [\fIcompiler options\fR] [\fIfiles...\fR]
 .br
-.B sindex
+.B semind
 [\fIoptions\fR] \fIrm\fR [\fIcommand options\fR] \fIpattern\fR
 .br
-.B sindex
+.B semind
 [\fIoptions\fR] \fIsearch\fR [\fIcommand options\fR] [\fIpattern\fR]
 .br
-.B sindex [\fIoptions\fR] \fIsearch\fR [\fIcommand options\fR] (\fI-e\fR|\fI-l\fR) \fIfilename\fR:\fIlinenr\fR:\fIcolumn\fR
+.B semind [\fIoptions\fR] \fIsearch\fR [\fIcommand options\fR] (\fI-e\fR|\fI-l\fR) \fIfilename\fR:\fIlinenr\fR:\fIcolumn\fR
 .br
 .SH DESCRIPTION
 .P
-sindex is the simple to use cscope-like tool based on sparse/dissect.  Unlike
+semind is the simple to use cscope-like tool based on sparse/dissect.  Unlike
 cscope it runs after pre-processor and thus it can't index the code filtered out
 by ifdef's, but otoh it understands how the symbol is used and it can track the
 usage of struct members.
@@ -44,7 +44,7 @@ wildcard pattern.
 .SH COMMON OPTIONS
 .TP
 \fB-D\fR, \fB--database=FILE\fR
-specify database file (default: ./sindex.sqlite).
+specify database file (default: ./semind.sqlite).
 .TP
 \fB-v\fR, \fB--verbose\fR
 show information about what is being done.
diff --git a/sindex.c b/semind.c
similarity index 72%
rename from sindex.c
rename to semind.c
index bff6d8c4df84..911fc7470a30 100644
--- a/sindex.c
+++ b/semind.c
@@ -1,5 +1,5 @@
 /*
- * sindex - semantic indexer for C.
+ * semind - semantic indexer for C.
  *
  * Copyright (C) 2020  Alexey Gladkov
  */
@@ -23,44 +23,44 @@
 #define U_DEF (0x100 << U_SHIFT)
 #define SINDEX_DATABASE_VERSION 1
 
-#define message(fmt, ...) sindex_error(0, 0, (fmt), ##__VA_ARGS__)
+#define message(fmt, ...) semind_error(0, 0, (fmt), ##__VA_ARGS__)
 
 static const char *progname;
-static const char *sindex_command = NULL;
+static const char *semind_command = NULL;
 
 // common options
-static const char *sindex_dbfile = "sindex.sqlite";
-static int sindex_verbose = 0;
+static const char *semind_dbfile = "semind.sqlite";
+static int semind_verbose = 0;
 static char cwd[PATH_MAX];
 static size_t n_cwd;
 
 // 'add' command options
-static struct string_list *sindex_filelist = NULL;
-static int sindex_include_local_syms = 0;
+static struct string_list *semind_filelist = NULL;
+static int semind_include_local_syms = 0;
 
-struct sindex_streams {
+struct semind_streams {
 	sqlite3_int64 id;
 };
 
-static struct sindex_streams *sindex_streams = NULL;
-static int sindex_streams_nr = 0;
+static struct semind_streams *semind_streams = NULL;
+static int semind_streams_nr = 0;
 
 // 'search' command options
-static int sindex_search_modmask;
-static int sindex_search_modmask_defined = 0;
-static int sindex_search_kind = 0;
-static char *sindex_search_path = NULL;
-static char *sindex_search_symbol = NULL;
-static const char *sindex_search_format = "(%m) %f\t%l\t%c\t%C\t%s";
+static int semind_search_modmask;
+static int semind_search_modmask_defined = 0;
+static int semind_search_kind = 0;
+static char *semind_search_path = NULL;
+static char *semind_search_symbol = NULL;
+static const char *semind_search_format = "(%m) %f\t%l\t%c\t%C\t%s";
 
 #define EXPLAIN_LOCATION 1
 #define USAGE_BY_LOCATION 2
-static int sindex_search_by_location;
-static char *sindex_search_filename;
-static int sindex_search_line;
-static int sindex_search_column;
+static int semind_search_by_location;
+static char *semind_search_filename;
+static int semind_search_line;
+static int semind_search_column;
 
-static sqlite3 *sindex_db = NULL;
+static sqlite3 *semind_db = NULL;
 static sqlite3_stmt *lock_stmt = NULL;
 static sqlite3_stmt *unlock_stmt = NULL;
 static sqlite3_stmt *insert_rec_stmt = NULL;
@@ -77,9 +77,9 @@ struct command {
 
 static void show_usage(void)
 {
-	if (sindex_command)
+	if (semind_command)
 		printf("Try '%s %s --help' for more information.\n",
-		       progname, sindex_command);
+		       progname, semind_command);
 	else
 		printf("Try '%s --help' for more information.\n",
 		       progname);
@@ -111,7 +111,7 @@ static void show_help(int ret)
 	    "\n"
 	    "Report bugs to authors.\n"
 	    "\n",
-	    progname, sindex_dbfile);
+	    progname, semind_dbfile);
 	exit(ret);
 }
 
@@ -179,17 +179,17 @@ static void show_help_search(int ret)
 	exit(ret);
 }
 
-static void sindex_print_progname(void)
+static void semind_print_progname(void)
 {
 	fprintf(stderr, "%s: ", progname);
-	if (sindex_command)
-		fprintf(stderr, "%s: ", sindex_command);
+	if (semind_command)
+		fprintf(stderr, "%s: ", semind_command);
 }
 
-static void sindex_error(int status, int errnum, const char *fmt, ...)
+static void semind_error(int status, int errnum, const char *fmt, ...)
 {
 	va_list ap;
-	sindex_print_progname();
+	semind_print_progname();
 
 	va_start(ap, fmt);
 	vfprintf(stderr, fmt, ap);
@@ -209,10 +209,10 @@ static void set_search_modmask(const char *v)
 	size_t n = strlen(v);
 
 	if (n != 1 && n != 3)
-		sindex_error(1, 0, "the length of mode value must be 1 or 3: %s", v);
+		semind_error(1, 0, "the length of mode value must be 1 or 3: %s", v);
 
-	sindex_search_modmask_defined = 1;
-	sindex_search_modmask = 0;
+	semind_search_modmask_defined = 1;
+	semind_search_modmask = 0;
 
 	if (n == 1) {
 		switch (v[0]) {
@@ -220,10 +220,10 @@ static void set_search_modmask(const char *v)
 			case 'w': v = "ww-"; break;
 			case 'm': v = "mmm"; break;
 			case '-': v = "---"; break;
-			default: sindex_error(1, 0, "unknown modificator: %s", v);
+			default: semind_error(1, 0, "unknown modificator: %s", v);
 		}
 	} else if (!strcmp(v, "def")) {
-		sindex_search_modmask = U_DEF;
+		semind_search_modmask = U_DEF;
 		return;
 	}
 
@@ -235,11 +235,11 @@ static void set_search_modmask(const char *v)
 
 	for (int i = 0; i < 3; i++) {
 		switch (v[i]) {
-			case 'r': sindex_search_modmask |= modes[i * 3];     break;
-			case 'w': sindex_search_modmask |= modes[i * 3 + 1]; break;
-			case 'm': sindex_search_modmask |= modes[i * 3 + 2]; break;
+			case 'r': semind_search_modmask |= modes[i * 3];     break;
+			case 'w': semind_search_modmask |= modes[i * 3 + 1]; break;
+			case 'm': semind_search_modmask |= modes[i * 3 + 2]; break;
 			case '-': break;
-			default:  sindex_error(1, 0,
+			default:  semind_error(1, 0,
 			                "unknown modificator in the mode value"
 			                " (`r', `w', `m' or `-' expected): %c", v[i]);
 		}
@@ -260,18 +260,18 @@ static void parse_cmdline(int argc, char **argv)
 	char *env;
 
 	if ((env = getenv("SINDEX_DATABASE")) != NULL)
-		sindex_dbfile = env;
+		semind_dbfile = env;
 
 	while ((c = getopt_long(argc, argv, "+B:D:vh", long_options, NULL)) != -1) {
 		switch (c) {
 			case 'D':
-				sindex_dbfile = optarg;
+				semind_dbfile = optarg;
 				break;
 			case 'B':
 				basedir = optarg;
 				break;
 			case 'v':
-				sindex_verbose++;
+				semind_verbose++;
 				break;
 			case 'h':
 				show_help(0);
@@ -285,7 +285,7 @@ static void parse_cmdline(int argc, char **argv)
 
 	if (basedir) {
 		if (!realpath(basedir, cwd))
-			sindex_error(1, errno, "unable to get project base directory");
+			semind_error(1, errno, "unable to get project base directory");
 		n_cwd = strlen(cwd);
 	}
 }
@@ -305,10 +305,10 @@ static void parse_cmdline_add(int argc, char **argv)
 	while ((c = getopt_long(argc, argv, "+vh", long_options, NULL)) != -1) {
 		switch (c) {
 			case 1:
-				sindex_include_local_syms = 1;
+				semind_include_local_syms = 1;
 				break;
 			case 'v':
-				sindex_verbose++;
+				semind_verbose++;
 				break;
 			case 'h':
 				show_help_add(0);
@@ -328,7 +328,7 @@ done:
 	// step back since sparse_initialize will ignore argv[0].
 	optind--;
 
-	sparse_initialize(argc - optind, argv + optind, &sindex_filelist);
+	sparse_initialize(argc - optind, argv + optind, &semind_filelist);
 }
 
 static void parse_cmdline_rm(int argc, char **argv)
@@ -343,7 +343,7 @@ static void parse_cmdline_rm(int argc, char **argv)
 	while ((c = getopt_long(argc, argv, "+vh", long_options, NULL)) != -1) {
 		switch (c) {
 			case 'v':
-				sindex_verbose++;
+				semind_verbose++;
 				break;
 			case 'h':
 				show_help_rm(0);
@@ -374,36 +374,36 @@ static void parse_cmdline_search(int argc, char **argv)
 	while ((c = getopt_long(argc, argv, "+ef:m:k:p:lvh", long_options, NULL)) != -1) {
 		switch (c) {
 			case 'e':
-				sindex_search_by_location = EXPLAIN_LOCATION;
+				semind_search_by_location = EXPLAIN_LOCATION;
 				break;
 			case 'l':
-				sindex_search_by_location = USAGE_BY_LOCATION;
+				semind_search_by_location = USAGE_BY_LOCATION;
 				break;
 			case 'f':
-				sindex_search_format = optarg;
+				semind_search_format = optarg;
 				break;
 			case 'm':
 				set_search_modmask(optarg);
 				break;
 			case 'k':
-				sindex_search_kind = tolower(optarg[0]);
+				semind_search_kind = tolower(optarg[0]);
 				break;
 			case 'p':
-				sindex_search_path = optarg;
+				semind_search_path = optarg;
 				break;
 			case 'v':
-				sindex_verbose++;
+				semind_verbose++;
 				break;
 			case 'h':
 				show_help_search(0);
 		}
 	}
 
-	if (sindex_search_by_location) {
+	if (semind_search_by_location) {
 		char *str;
 
 		if (optind == argc)
-			sindex_error(1, 0, "one argument required");
+			semind_error(1, 0, "one argument required");
 
 		str = argv[optind];
 
@@ -414,18 +414,18 @@ static void parse_cmdline_search(int argc, char **argv)
 				*ptr++ = '\0';
 
 			if (*str != '\0') {
-				if (!sindex_search_filename) {
-					sindex_search_filename = str;
-				} else if (!sindex_search_line) {
-					sindex_search_line = atoi(str);
-				} else if (!sindex_search_column) {
-					sindex_search_column = atoi(str);
+				if (!semind_search_filename) {
+					semind_search_filename = str;
+				} else if (!semind_search_line) {
+					semind_search_line = atoi(str);
+				} else if (!semind_search_column) {
+					semind_search_column = atoi(str);
 				}
 			}
 			str = ptr;
 		}
 	} else if (optind < argc)
-		sindex_search_symbol = argv[optind++];
+		semind_search_symbol = argv[optind++];
 }
 
 static int query_appendf(sqlite3_str *query, const char *fmt, ...)
@@ -452,22 +452,22 @@ static int query_appendf(sqlite3_str *query, const char *fmt, ...)
 static inline void sqlite_bind_text(sqlite3_stmt *stmt, const char *field, const char *var, int len)
 {
 	if (sqlite3_bind_text(stmt, sqlite3_bind_parameter_index(stmt, field), var, len, SQLITE_STATIC) != SQLITE_OK)
-		sindex_error(1, 0, "unable to bind value for %s: %s", field, sqlite3_errmsg(sindex_db));
+		semind_error(1, 0, "unable to bind value for %s: %s", field, sqlite3_errmsg(semind_db));
 }
 
 static inline void sqlite_bind_int64(sqlite3_stmt *stmt, const char *field, long long var)
 {
 	if (sqlite3_bind_int64(stmt, sqlite3_bind_parameter_index(stmt, field), var) != SQLITE_OK)
-		sindex_error(1, 0, "unable to bind value for %s: %s", field, sqlite3_errmsg(sindex_db));
+		semind_error(1, 0, "unable to bind value for %s: %s", field, sqlite3_errmsg(semind_db));
 }
 
 static inline void sqlite_prepare(const char *sql, sqlite3_stmt **stmt)
 {
 	int ret;
 	do {
-		ret = sqlite3_prepare_v2(sindex_db, sql, -1, stmt, NULL);
+		ret = sqlite3_prepare_v2(semind_db, sql, -1, stmt, NULL);
 		if (ret != SQLITE_OK && ret != SQLITE_BUSY)
-			sindex_error(1, 0, "unable to prepare query: %s: %s", sqlite3_errmsg(sindex_db), sql);
+			semind_error(1, 0, "unable to prepare query: %s: %s", sqlite3_errmsg(semind_db), sql);
 	} while (ret == SQLITE_BUSY);
 }
 
@@ -475,9 +475,9 @@ static inline void sqlite_prepare_persistent(const char *sql, sqlite3_stmt **stm
 {
 	int ret;
 	do {
-		ret = sqlite3_prepare_v3(sindex_db, sql, -1, SQLITE_PREPARE_PERSISTENT, stmt, NULL);
+		ret = sqlite3_prepare_v3(semind_db, sql, -1, SQLITE_PREPARE_PERSISTENT, stmt, NULL);
 		if (ret != SQLITE_OK && ret != SQLITE_BUSY)
-			sindex_error(1, 0, "unable to prepare query: %s: %s", sqlite3_errmsg(sindex_db), sql);
+			semind_error(1, 0, "unable to prepare query: %s: %s", sqlite3_errmsg(semind_db), sql);
 	} while (ret == SQLITE_BUSY);
 }
 
@@ -494,7 +494,7 @@ static int sqlite_run(sqlite3_stmt *stmt)
 {
 	int ret = sqlite3_step(stmt);
 	if (ret != SQLITE_DONE && ret != SQLITE_ROW)
-		sindex_error(1, 0, "unable to process query: %s: %s", sqlite3_errmsg(sindex_db), sqlite3_sql(stmt));
+		semind_error(1, 0, "unable to process query: %s: %s", sqlite3_errmsg(semind_db), sqlite3_sql(stmt));
 	return ret;
 }
 
@@ -522,7 +522,7 @@ static sqlite3_int64 get_db_version(void)
 static void set_db_version(void)
 {
 	char *sql;
-	sqlite3_str *query = sqlite3_str_new(sindex_db);
+	sqlite3_str *query = sqlite3_str_new(semind_db);
 
 	if (query_appendf(query, "PRAGMA user_version = %d", SINDEX_DATABASE_VERSION) < 0)
 		exit(1);
@@ -536,7 +536,7 @@ static void open_temp_database(void)
 {
 	static const char *database_schema[] = {
 		"ATTACH ':memory:' AS tempdb",
-		"CREATE TABLE tempdb.sindex ("
+		"CREATE TABLE tempdb.semind ("
 			" file INTEGER NOT NULL,"
 			" line INTEGER NOT NULL,"
 			" column INTEGER NOT NULL,"
@@ -560,7 +560,7 @@ static void open_database(const char *filename, int flags)
 			" name TEXT UNIQUE NOT NULL,"
 			" mtime INTEGER NOT NULL"
 		")",
-		"CREATE TABLE sindex ("
+		"CREATE TABLE semind ("
 			" file INTEGER NOT NULL REFERENCES file(id) ON DELETE CASCADE,"
 			" line INTEGER NOT NULL,"
 			" column INTEGER NOT NULL,"
@@ -569,15 +569,15 @@ static void open_database(const char *filename, int flags)
 			" context TEXT,"
 			" mode INTEGER NOT NULL"
 		")",
-		"CREATE UNIQUE INDEX sindex_0 ON sindex (symbol, kind, mode, file, line, column)",
-		"CREATE INDEX sindex_1 ON sindex (file)",
+		"CREATE UNIQUE INDEX semind_0 ON semind (symbol, kind, mode, file, line, column)",
+		"CREATE INDEX semind_1 ON semind (file)",
 		NULL,
 	};
 
 	int exists = !access(filename, R_OK);
 
-	if (sqlite3_open_v2(filename, &sindex_db, flags, NULL) != SQLITE_OK)
-		sindex_error(1, 0, "unable to open database: %s: %s", filename, sqlite3_errmsg(sindex_db));
+	if (sqlite3_open_v2(filename, &semind_db, flags, NULL) != SQLITE_OK)
+		semind_error(1, 0, "unable to open database: %s: %s", filename, sqlite3_errmsg(semind_db));
 
 	sqlite_command("PRAGMA journal_mode = WAL");
 	sqlite_command("PRAGMA synchronous = OFF");
@@ -587,7 +587,7 @@ static void open_database(const char *filename, int flags)
 
 	if (exists) {
 		if (get_db_version() < SINDEX_DATABASE_VERSION)
-			sindex_error(1, 0, "%s: Database too old. Please rebuild it.", filename);
+			semind_error(1, 0, "%s: Database too old. Please rebuild it.", filename);
 		return;
 	}
 
@@ -627,16 +627,16 @@ static void insert_record(struct index_record *rec)
 
 static void update_stream(void)
 {
-	if (sindex_streams_nr >= input_stream_nr)
+	if (semind_streams_nr >= input_stream_nr)
 		return;
 
-	sindex_streams = realloc(sindex_streams, input_stream_nr * sizeof(struct sindex_streams));
-	if (!sindex_streams)
-		sindex_error(1, errno, "realloc");
+	semind_streams = realloc(semind_streams, input_stream_nr * sizeof(struct semind_streams));
+	if (!semind_streams)
+		semind_error(1, errno, "realloc");
 
 	sqlite_run(lock_stmt);
 
-	for (int i = sindex_streams_nr; i < input_stream_nr; i++) {
+	for (int i = semind_streams_nr; i < input_stream_nr; i++) {
 		struct stat st;
 		const char *filename;
 		char fullname[PATH_MAX];
@@ -647,26 +647,26 @@ static void update_stream(void)
 			 * FIXME: Files in the input_streams may be duplicated.
 			 */
 			if (stat(input_streams[i].name, &st) < 0)
-				sindex_error(1, errno, "stat: %s", input_streams[i].name);
+				semind_error(1, errno, "stat: %s", input_streams[i].name);
 
 			cur_mtime = st.st_mtime;
 
 			if (!realpath(input_streams[i].name, fullname))
-				sindex_error(1, errno, "realpath: %s", input_streams[i].name);
+				semind_error(1, errno, "realpath: %s", input_streams[i].name);
 
 			if (!strncmp(fullname, cwd, n_cwd) && fullname[n_cwd] == '/') {
 				filename = fullname + n_cwd + 1;
-				sindex_streams[i].id = 0;
+				semind_streams[i].id = 0;
 			} else {
-				sindex_streams[i].id = -1;
+				semind_streams[i].id = -1;
 				continue;
 			}
 		} else {
-			sindex_streams[i].id = -1;
+			semind_streams[i].id = -1;
 			continue;
 		}
 
-		if (sindex_verbose > 1)
+		if (semind_verbose > 1)
 			message("filename: %s", filename);
 
 		sqlite_bind_text(select_file_stmt, "@name", filename, -1);
@@ -674,7 +674,7 @@ static void update_stream(void)
 		if (sqlite_run(select_file_stmt) == SQLITE_ROW) {
 			sqlite3_int64 old_mtime;
 
-			sindex_streams[i].id = sqlite3_column_int64(select_file_stmt, 0);
+			semind_streams[i].id = sqlite3_column_int64(select_file_stmt, 0);
 			old_mtime = sqlite3_column_int64(select_file_stmt, 1);
 
 			sqlite_reset_stmt(select_file_stmt);
@@ -694,12 +694,12 @@ static void update_stream(void)
 		sqlite_run(insert_file_stmt);
 		sqlite_reset_stmt(insert_file_stmt);
 
-		sindex_streams[i].id = sqlite3_last_insert_rowid(sindex_db);
+		semind_streams[i].id = sqlite3_last_insert_rowid(semind_db);
 	}
 
 	sqlite_run(unlock_stmt);
 
-	sindex_streams_nr = input_stream_nr;
+	semind_streams_nr = input_stream_nr;
 }
 
 static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym)
@@ -710,10 +710,10 @@ static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym)
 
 	update_stream();
 
-	if (sindex_streams[pos->stream].id == -1)
+	if (semind_streams[pos->stream].id == -1)
 		return;
 
-	if (!sindex_include_local_syms && sym_is_local(sym))
+	if (!semind_include_local_syms && sym_is_local(sym))
 		return;
 
 	if (!sym->ident) {
@@ -730,7 +730,7 @@ static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym)
 	rec.sym_len = sym->ident->len;
 	rec.kind    = sym->kind;
 	rec.mode    = mode;
-	rec.file    = sindex_streams[pos->stream].id;
+	rec.file    = semind_streams[pos->stream].id;
 	rec.line    = pos->line;
 	rec.col     = pos->pos;
 
@@ -747,10 +747,10 @@ static void r_member(unsigned mode, struct position *pos, struct symbol *sym, st
 
 	update_stream();
 
-	if (sindex_streams[pos->stream].id == -1)
+	if (semind_streams[pos->stream].id == -1)
 		return;
 
-	if (!sindex_include_local_syms && sym_is_local(sym))
+	if (!semind_include_local_syms && sym_is_local(sym))
 		return;
 
 	ni = built_in_ident("?");
@@ -769,7 +769,7 @@ static void r_member(unsigned mode, struct position *pos, struct symbol *sym, st
 	rec.sym_len = si->len + mi->len + 1;
 	rec.kind    = 'm';
 	rec.mode    = mode;
-	rec.file    = sindex_streams[pos->stream].id;
+	rec.file    = semind_streams[pos->stream].id;
 	rec.line    = pos->line;
 	rec.col     = pos->pos;
 
@@ -806,7 +806,7 @@ static void command_add(int argc, char **argv)
 		&unlock_stmt);
 
 	sqlite_prepare_persistent(
-		"INSERT OR IGNORE INTO tempdb.sindex "
+		"INSERT OR IGNORE INTO tempdb.semind "
 		"(context, symbol, kind, mode, file, line, column) "
 		"VALUES (@context, @symbol, @kind, @mode, @file, @line, @column)",
 		&insert_rec_stmt);
@@ -823,10 +823,10 @@ static void command_add(int argc, char **argv)
 		"DELETE FROM file WHERE name == @name",
 		&delete_file_stmt);
 
-	dissect(&reporter, sindex_filelist);
+	dissect(&reporter, semind_filelist);
 
 	sqlite_run(lock_stmt);
-	sqlite_command("INSERT OR IGNORE INTO sindex SELECT * FROM tempdb.sindex");
+	sqlite_command("INSERT OR IGNORE INTO semind SELECT * FROM tempdb.semind");
 	sqlite_run(unlock_stmt);
 
 	sqlite3_finalize(insert_rec_stmt);
@@ -835,7 +835,7 @@ static void command_add(int argc, char **argv)
 	sqlite3_finalize(delete_file_stmt);
 	sqlite3_finalize(lock_stmt);
 	sqlite3_finalize(unlock_stmt);
-	free(sindex_streams);
+	free(semind_streams);
 }
 
 static void command_rm(int argc, char **argv)
@@ -845,7 +845,7 @@ static void command_rm(int argc, char **argv)
 	sqlite_command("BEGIN IMMEDIATE");
 	sqlite_prepare("DELETE FROM file WHERE name GLOB @file", &stmt);
 
-	if (sindex_verbose > 1)
+	if (semind_verbose > 1)
 		message("SQL: %s", sqlite3_sql(stmt));
 
 	for (int i = 0; i < argc; i++) {
@@ -877,12 +877,12 @@ static inline void print_mode(char *value)
 #undef U
 }
 
-static char *sindex_file_name;
-static FILE *sindex_file_fd;
-static int sindex_file_lnum;
-static char *sindex_line;
-static size_t sindex_line_buflen;
-static int sindex_line_len;
+static char *semind_file_name;
+static FILE *semind_file_fd;
+static int semind_file_lnum;
+static char *semind_line;
+static size_t semind_line_buflen;
+static int semind_line_len;
 
 static void print_file_line(const char *name, int lnum)
 {
@@ -890,43 +890,43 @@ static void print_file_line(const char *name, int lnum)
 	 * All files are sorted by name and line number. So, we can reopen
 	 * the file and read it line by line.
 	 */
-	if (!sindex_file_name || strcmp(sindex_file_name, name)) {
-		if (sindex_file_fd) {
-			fclose(sindex_file_fd);
-			free(sindex_file_name);
+	if (!semind_file_name || strcmp(semind_file_name, name)) {
+		if (semind_file_fd) {
+			fclose(semind_file_fd);
+			free(semind_file_name);
 		}
 
-		sindex_file_name = strdup(name);
+		semind_file_name = strdup(name);
 
-		if (!sindex_file_name)
-			sindex_error(1, errno, "strdup");
+		if (!semind_file_name)
+			semind_error(1, errno, "strdup");
 
-		sindex_file_fd = fopen(name, "r");
+		semind_file_fd = fopen(name, "r");
 
-		if (!sindex_file_fd)
-			sindex_error(1, errno, "fopen: %s", name);
+		if (!semind_file_fd)
+			semind_error(1, errno, "fopen: %s", name);
 
-		sindex_file_lnum = 0;
+		semind_file_lnum = 0;
 	}
 
 	do {
-		if (sindex_file_lnum == lnum) {
-			if (sindex_line[sindex_line_len-1] == '\n')
-				sindex_line_len--;
-			printf("%.*s", sindex_line_len, sindex_line);
+		if (semind_file_lnum == lnum) {
+			if (semind_line[semind_line_len-1] == '\n')
+				semind_line_len--;
+			printf("%.*s", semind_line_len, semind_line);
 			break;
 		}
-		sindex_file_lnum++;
+		semind_file_lnum++;
 		errno = 0;
-	} while((sindex_line_len = getline(&sindex_line, &sindex_line_buflen, sindex_file_fd)) != -1);
+	} while((semind_line_len = getline(&semind_line, &semind_line_buflen, semind_file_fd)) != -1);
 
 	if (errno && errno != EOF)
-		sindex_error(1, errno, "getline");
+		semind_error(1, errno, "getline");
 }
 
 static int search_query_callback(void *data, int argc, char **argv, char **colname)
 {
-	char *fmt = (char *) sindex_search_format;
+	char *fmt = (char *) semind_search_format;
 	char buf[32];
 	int quote = 0;
 	int n = 0;
@@ -948,7 +948,7 @@ static int search_query_callback(void *data, int argc, char **argv, char **colna
 			c = *fmt;
 
 			if (c == '\0')
-				sindex_error(1, 0, "unexpected end of format string");
+				semind_error(1, 0, "unexpected end of format string");
 
 			switch (c) {
 				case 'f': colnum = 0; goto print_string;
@@ -995,7 +995,7 @@ static int search_query_callback(void *data, int argc, char **argv, char **colna
 			}
 
 			if (pos == fmt)
-				sindex_error(1, 0, "invalid format specification: %%%c", c);
+				semind_error(1, 0, "invalid format specification: %%%c", c);
 
 			continue;
 		} else if (c == '\\') {
@@ -1024,104 +1024,104 @@ static void command_search(int argc, char **argv)
 {
 	char *sql;
 	char *dberr = NULL;
-	sqlite3_str *query = sqlite3_str_new(sindex_db);
+	sqlite3_str *query = sqlite3_str_new(semind_db);
 
 	if (chdir(cwd) < 0)
-		sindex_error(1, errno, "unable to change directory: %s", cwd);
+		semind_error(1, errno, "unable to change directory: %s", cwd);
 
 	if (query_appendf(query,
 	                  "SELECT"
 	                  " file.name,"
-	                  " sindex.line,"
-	                  " sindex.column,"
-	                  " sindex.context,"
-	                  " sindex.symbol,"
-	                  " sindex.mode,"
-	                  " sindex.kind "
-	                  "FROM sindex, file "
-	                  "WHERE sindex.file == file.id") < 0)
+	                  " semind.line,"
+	                  " semind.column,"
+	                  " semind.context,"
+	                  " semind.symbol,"
+	                  " semind.mode,"
+	                  " semind.kind "
+	                  "FROM semind, file "
+	                  "WHERE semind.file == file.id") < 0)
 		goto fail;
 
-	if (sindex_search_kind) {
-		if (query_appendf(query, " AND sindex.kind == %d", sindex_search_kind) < 0)
+	if (semind_search_kind) {
+		if (query_appendf(query, " AND semind.kind == %d", semind_search_kind) < 0)
 			goto fail;
 	}
 
-	if (sindex_search_symbol) {
+	if (semind_search_symbol) {
 		int ret;
 
 		if (query_appendf(query, " AND ") < 0)
 			goto fail;
 
-		if (strpbrk(sindex_search_symbol, "*?[]"))
-			ret = query_appendf(query, "sindex.symbol GLOB %Q", sindex_search_symbol);
+		if (strpbrk(semind_search_symbol, "*?[]"))
+			ret = query_appendf(query, "semind.symbol GLOB %Q", semind_search_symbol);
 		else
-			ret = query_appendf(query, "sindex.symbol == %Q", sindex_search_symbol);
+			ret = query_appendf(query, "semind.symbol == %Q", semind_search_symbol);
 
 		if (ret < 0)
 			goto fail;
 	}
 
-	if (sindex_search_modmask_defined) {
-		if (!sindex_search_modmask) {
-			if (query_appendf(query, " AND sindex.mode == %d", sindex_search_modmask) < 0)
+	if (semind_search_modmask_defined) {
+		if (!semind_search_modmask) {
+			if (query_appendf(query, " AND semind.mode == %d", semind_search_modmask) < 0)
 				goto fail;
-		} else if (query_appendf(query, " AND (sindex.mode & %d) != 0", sindex_search_modmask) < 0)
+		} else if (query_appendf(query, " AND (semind.mode & %d) != 0", semind_search_modmask) < 0)
 			goto fail;
 	}
 
-	if (sindex_search_path) {
-		if (query_appendf(query, " AND file.name GLOB %Q", sindex_search_path) < 0)
+	if (semind_search_path) {
+		if (query_appendf(query, " AND file.name GLOB %Q", semind_search_path) < 0)
 			goto fail;
 	}
 
-	if (sindex_search_by_location == EXPLAIN_LOCATION) {
-		if (query_appendf(query, " AND file.name == %Q", sindex_search_filename) < 0)
+	if (semind_search_by_location == EXPLAIN_LOCATION) {
+		if (query_appendf(query, " AND file.name == %Q", semind_search_filename) < 0)
 			goto fail;
-		if (sindex_search_line &&
-		    query_appendf(query, " AND sindex.line == %d", sindex_search_line) < 0)
+		if (semind_search_line &&
+		    query_appendf(query, " AND semind.line == %d", semind_search_line) < 0)
 			goto fail;
-		if (sindex_search_column &&
-		    query_appendf(query, " AND sindex.column == %d", sindex_search_column) < 0)
+		if (semind_search_column &&
+		    query_appendf(query, " AND semind.column == %d", semind_search_column) < 0)
 			goto fail;
-	} else if (sindex_search_by_location == USAGE_BY_LOCATION) {
-		if (query_appendf(query, " AND sindex.symbol IN (") < 0)
+	} else if (semind_search_by_location == USAGE_BY_LOCATION) {
+		if (query_appendf(query, " AND semind.symbol IN (") < 0)
 			goto fail;
 		if (query_appendf(query,
-		                 "SELECT sindex.symbol FROM sindex, file WHERE"
-				 " sindex.file == file.id AND"
-		                 " file.name == %Q", sindex_search_filename) < 0)
+		                 "SELECT semind.symbol FROM semind, file WHERE"
+				 " semind.file == file.id AND"
+		                 " file.name == %Q", semind_search_filename) < 0)
 			goto fail;
-		if (sindex_search_line &&
-		    query_appendf(query, " AND sindex.line == %d", sindex_search_line) < 0)
+		if (semind_search_line &&
+		    query_appendf(query, " AND semind.line == %d", semind_search_line) < 0)
 			goto fail;
-		if (sindex_search_column &&
-		    query_appendf(query, " AND sindex.column == %d", sindex_search_column) < 0)
+		if (semind_search_column &&
+		    query_appendf(query, " AND semind.column == %d", semind_search_column) < 0)
 			goto fail;
 		if (query_appendf(query, ")") < 0)
 			goto fail;
 	}
 
-	if (query_appendf(query, " ORDER BY file.name, sindex.line, sindex.column ASC", sindex_search_path) < 0)
+	if (query_appendf(query, " ORDER BY file.name, semind.line, semind.column ASC", semind_search_path) < 0)
 		goto fail;
 
 	sql = sqlite3_str_value(query);
 
-	if (sindex_verbose > 1)
+	if (semind_verbose > 1)
 		message("SQL: %s", sql);
 
-	sqlite3_exec(sindex_db, sql, search_query_callback, NULL, &dberr);
+	sqlite3_exec(semind_db, sql, search_query_callback, NULL, &dberr);
 	if (dberr)
-		sindex_error(1, 0, "sql query failed: %s", dberr);
+		semind_error(1, 0, "sql query failed: %s", dberr);
 fail:
 	sql = sqlite3_str_finish(query);
 	sqlite3_free(sql);
 
-	if (sindex_file_fd) {
-		fclose(sindex_file_fd);
-		free(sindex_file_name);
+	if (semind_file_fd) {
+		fclose(semind_file_fd);
+		free(semind_file_name);
 	}
-	free(sindex_line);
+	free(semind_line);
 }
 
 
@@ -1156,25 +1156,25 @@ int main(int argc, char **argv)
 		progname++;
 
 	if (!realpath(".", cwd))
-		sindex_error(1, errno, "unable to get current directory");
+		semind_error(1, errno, "unable to get current directory");
 	n_cwd = strlen(cwd);
 
 	parse_cmdline(argc, argv);
 
 	for (cmd = commands; cmd->name && strcmp(argv[optind], cmd->name); cmd++);
 	if (!cmd->name)
-		sindex_error(1, 0, "unknown command: %s", argv[optind]);
+		semind_error(1, 0, "unknown command: %s", argv[optind]);
 	optind++;
 
-	sindex_command = cmd->name;
+	semind_command = cmd->name;
 
 	if (cmd->parse_cmdline)
 		cmd->parse_cmdline(argc, argv);
 
-	open_database(sindex_dbfile, cmd->dbflags);
+	open_database(semind_dbfile, cmd->dbflags);
 	cmd->handler(argc - optind, argv + optind);
 
-	sqlite3_close(sindex_db);
+	sqlite3_close(semind_db);
 
 	return 0;
 }
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-08-09 19:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <reply-7f2b156a8ad4ece3334e6b9712c2de05@salsa.debian.org>
     [not found] ` <merge_request_28506@salsa.debian.org>
     [not found]   ` <note_184887@salsa.debian.org>
2020-08-01 16:54     ` sparse | upgrade to upstream v0.6.2 (!2) Luc Van Oostenryck
     [not found]   ` <note_184882@salsa.debian.org>
2020-08-02 13:29     ` Luc Van Oostenryck
2020-08-09 19:21     ` Luc Van Oostenryck
     [not found]   ` <note_185118@salsa.debian.org>
     [not found]     ` <note_185156@salsa.debian.org>
2020-08-02 21:09       ` Luc Van Oostenryck
     [not found]   ` <note_185002@salsa.debian.org>
     [not found]     ` <note_185155@salsa.debian.org>
2020-08-02 21:30       ` Luc Van Oostenryck
2020-08-03 14:53         ` Alexey Gladkov
2020-08-04 16:38           ` Alexey Gladkov
2020-08-04 18:52             ` Oleg Nesterov
2020-08-04 19:33             ` Luc Van Oostenryck
2020-08-04 20:02             ` Luc Van Oostenryck
2020-08-05 10:16               ` Alexey Gladkov
     [not found] <note_185299@salsa.debian.org>
     [not found] ` <note_185431@salsa.debian.org>
     [not found]   ` <note_185453@salsa.debian.org>
     [not found]     ` <note_185458@salsa.debian.org>
     [not found]       ` <note_185460@salsa.debian.org>
     [not found]         ` <note_185461@salsa.debian.org>
     [not found]           ` <note_185530@salsa.debian.org>
     [not found]             ` <note_185532@salsa.debian.org>
     [not found]               ` <20200805110418.iutr56vyewhbqr7v@ltop.local>
     [not found]                 ` <20200805112141.ier2xkhm5sqjtbck@comp-core-i7-2640m-0182e6>
2020-08-05 15:20                   ` Luc Van Oostenryck
2020-08-05 15:44                     ` Alexey Gladkov
2020-08-05 19:58                       ` Luc Van Oostenryck

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 NNTP newsgroup(s).