Пример #1
0
int
replaceAttributesTable (const char *directory, const char *name) {
  AttributesTable *newTable = NULL;

  if (name) {
    char *path;

    if ((path = makeAttributesTablePath(directory, name))) {
      logMessage(LOG_DEBUG, "compiling attributes table: %s", path);

      if (!(newTable = compileAttributesTable(path))) {
        logMessage(LOG_ERR, "%s: %s", gettext("cannot compile attributes table"), path);
      }

      free(path);
    }
  } else {
    newTable = &internalAttributesTable;
  }

  if (newTable) {
    AttributesTable *oldTable = attributesTable;

    attributesTable = newTable;
    destroyAttributesTable(oldTable);
    return 1;
  }

  logMessage(LOG_ERR, "%s: %s", gettext("cannot load attributes table"), name);
  return 0;
}
Пример #2
0
int
replaceAttributesTable (const char *directory, const char *name) {
  int ok = 0;
  char *path;

  if ((path = makeAttributesTablePath(directory, name))) {
    AttributesTable *newTable;

    logMessage(LOG_DEBUG, "compiling attributes table: %s", path);
    if ((newTable = compileAttributesTable(path))) {
      AttributesTable *oldTable = attributesTable;
      attributesTable = newTable;
      destroyAttributesTable(oldTable);
      ok = 1;
    } else {
      logMessage(LOG_ERR, "%s: %s", gettext("cannot compile attributes table"), path);
    }

    free(path);
  }

  if (!ok) logMessage(LOG_ERR, "%s: %s", gettext("cannot load attributes table"), name);
  return ok;
}