Re: new function for tsquery creartion - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: new function for tsquery creartion
Date
Msg-id 151602125554.25640.2584561162347369841.pgcf@coridan.postgresql.org
Whole thread Raw
In response to Re: new function for tsquery creartion  (Victor Drobny <v.drobny@postgrespro.ru>)
List pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Here are a few minor issues:

```
+/*
+ * Checks if 'str' starts with a 'prefix'
+ */
+static bool
+has_prefix(char * str, char * prefix)
+{
+   if (strlen(prefix) > strlen(str))
+   {
+       return false;
+   }
+   return strstr(str, prefix) == str;
+}
```

strlen() check is redundant.

```
+           case OP_AROUND:
+               snprintf(in->cur, 256, " AROUND(%d) %s", distance, nrm.buf);
+               break;
```

Instead of the constant 256 it's better to use sizeof().

Apart from these issues this patch looks not bad.

The new status of this patch is: Ready for Committer

pgsql-hackers by date:

Previous
From: Joe Wildish
Date:
Subject: Re: Implementing SQL ASSERTION
Next
From: Alvaro Herrera
Date:
Subject: Re: WIP: a way forward on bootstrap data