* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/ .
+ * along with this program. If not, see https://www.gnu.org/licenses/ .
*
* Author: David Bremner <david@tethera.net>
*/
map->sorted = true;
}
-static bool
+static int
string_cmp (const char *a, const char *b, bool exact)
{
if (exact)
}
+void
+_notmuch_string_map_set (notmuch_string_map_t *map,
+ const char *key,
+ const char *val)
+{
+ notmuch_string_pair_t *pair;
+
+ /* this means that calling string_map_set invalidates iterators */
+ _notmuch_string_map_sort (map);
+ pair = bsearch_first (map->pairs, map->length, key, true);
+ if (! pair)
+ _notmuch_string_map_append (map, key, val);
+ else {
+ talloc_free (pair->value);
+ pair->value = talloc_strdup (map->pairs, val);
+ }
+}
+
const char *
_notmuch_string_map_get (notmuch_string_map_t *map, const char *key)
{