Merge branch 'master' into paz-927
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 6 Mar 2015 10:17:31 +0000 (11:17 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 6 Mar 2015 10:17:31 +0000 (11:17 +0100)
1  2 
src/session.c
win/makefile

diff --combined src/session.c
@@@ -204,29 -204,18 +204,18 @@@ void add_facet(struct session *s, cons
  
      if (wrbuf_len(facet_wrbuf))
      {
-         int i;
-         for (i = 0; i < s->num_termlists; i++)
-             if (!strcmp(s->termlists[i].name, type))
+         struct named_termlist **tp = &s->termlists;
+         for (; (*tp); tp = &(*tp)->next)
+             if (!strcmp((*tp)->name, type))
                  break;
-         if (i == s->num_termlists)
+         if (!*tp)
          {
-             if (i == SESSION_MAX_TERMLISTS)
-             {
-                 session_log(s, YLOG_FATAL, "Too many termlists");
-                 wrbuf_destroy(facet_wrbuf);
-                 wrbuf_destroy(display_wrbuf);
-                 return;
-             }
-             s->termlists[i].name = nmem_strdup(s->nmem, type);
-             s->termlists[i].termlist = termlist_create(s->nmem);
-             s->num_termlists = i + 1;
+             *tp = nmem_malloc(s->nmem, sizeof(**tp));
+             (*tp)->name = nmem_strdup(s->nmem, type);
+             (*tp)->termlist = termlist_create(s->nmem);
+             (*tp)->next = 0;
          }
- #if 0
-         session_log(s, YLOG_LOG, "Facets for %s: %s norm:%s (%d)", type, value, wrbuf_cstr(facet_wrbuf), count);
- #endif
-         termlist_insert(s->termlists[i].termlist, wrbuf_cstr(display_wrbuf),
+         termlist_insert((*tp)->termlist, wrbuf_cstr(display_wrbuf),
                          wrbuf_cstr(facet_wrbuf), count);
      }
      wrbuf_destroy(facet_wrbuf);
@@@ -508,6 -497,7 +497,6 @@@ static void select_targets_callback(str
          l->next = se->clients_cached;
          se->clients_cached = l;
      }
 -    /* set session always. If may be 0 if client is not active */
      client_set_session(cl, se);
  
      l = xmalloc(sizeof(*l));
@@@ -556,7 -546,6 +545,7 @@@ static void session_remove_cached_clien
          client_lock(l->client);
          client_set_session(l->client, 0);
          client_set_database(l->client, 0);
 +        client_mark_dead(l->client);
          client_unlock(l->client);
          client_destroy(l->client);
          xfree(l);
@@@ -604,8 -593,7 +593,7 @@@ static void session_clear_set(struct se
                      nmem_total(se->nmem));
      nmem_reset(se->nmem);
      se->total_records = se->total_merged = 0;
-     se->num_termlists = 0;
+     se->termlists = 0;
      relevance_clear(se->relevance);
  
      /* reset list of sorted results and clear to relevance search */
@@@ -1025,7 -1013,7 +1013,7 @@@ struct session *new_session(NMEM nmem, 
      session->total_records = 0;
      session->number_of_warnings_unknown_elements = 0;
      session->number_of_warnings_unknown_metadata = 0;
-     session->num_termlists = 0;
+     session->termlists = 0;
      session->reclist = reclist_create(nmem);
      session->clients_active = 0;
      session->clients_cached = 0;
@@@ -1191,9 -1179,10 +1179,10 @@@ void perform_termlist(struct http_chann
          const char *tname;
          int must_generate_empty = 1; /* bug 5350 */
  
-         for (i = 0; i < se->num_termlists; i++)
+         struct named_termlist *t = se->termlists;
+         for (; t; t = t->next)
          {
-             tname = se->termlists[i].name;
+             tname = t->name;
              if (!strcmp(names[j], tname) || !strcmp(names[j], "*"))
              {
                  struct termlist_score **p = 0;
                  wrbuf_puts(c->wrbuf, "\">\n");
                  must_generate_empty = 0;
  
-                 p = termlist_highscore(se->termlists[i].termlist, &len,
-                                        nmem_tmp);
+                 p = termlist_highscore(t->termlist, &len, nmem_tmp);
                  if (p)
                  {
                      int i;
diff --combined win/makefile
@@@ -5,7 -5,7 +5,7 @@@
  DEBUG=0   # 0 for release, 1 for debug
  USE_MANIFEST = 0 # Can be enabled Visual Studio 2005/2008
  PACKAGE_NAME=pazpar2
- PACKAGE_VERSION=1.8.5
+ PACKAGE_VERSION=1.8.6
  
  # YAZ
  YAZ_DIR=..\..\yaz
@@@ -175,6 -175,8 +175,6 @@@ LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE
  # Source and object modules
  
  PAZPAR2_OBJS = \
 -   "$(OBJDIR)\getaddrinfo.obj" \
 -   "$(OBJDIR)\host.obj" \
     "$(OBJDIR)\pazpar2.obj" \
     "$(OBJDIR)\pazpar2_config.obj" \
     "$(OBJDIR)\http.obj" \