if (tmp == NULL)
return 0;
def = GNUNET_strdup (tmp);
- level = -1;
from_line = 0;
to_line = INT_MAX;
for (p = def, state = 0, start = def; keep_looking; p++)
from_line = strtol (start, &t, 10);
if (errno != 0 || from_line < 0)
{
- free (def);
+ GNUNET_free (def);
return counter;
}
if (t < p && t[0] == '-')
to_line = strtol (start, &t, 10);
if (errno != 0 || to_line < 0 || t != p)
{
- free (def);
+ GNUNET_free (def);
return counter;
}
}
0 != add_definition (comp, file, function, from_line, to_line,
level, force))
{
- free (def);
+ GNUNET_free (def);
return counter;
}
counter += 1;
break;
}
}
- free (def);
+ GNUNET_free (def);
return counter;
}
#if WINDOWS
O_BINARY |
#endif
- O_WRONLY);
+ O_WRONLY | O_CREAT,
+#if WINDOWS
+ _S_IREAD | _S_IWRITE
+#else
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+#endif
+ );
if (altlog_fd != -1)
{
int dup_return;
}
if (altlog_fd == -1)
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "fopen", fn);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", fn);
if (dirwarn)
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Failed to create or access directory for log file `%s'\n"),
if (GNUNET_stderr != NULL)
{
- fprintf (GNUNET_stderr, "%s %s %s %s", datestr, comp,
+ FPRINTF (GNUNET_stderr, "%s %s %s %s", datestr, comp,
GNUNET_error_type_to_string (kind), msg);
fflush (GNUNET_stderr);
}
return (const char *) ret.encoding;
}
+/**
+ * Convert a peer identity to a string (for printing debug messages).
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ *
+ * @param pid the peer identity
+ * @return string form of the pid; will be overwritten by next
+ * call to GNUNET_i2s.
+ */
+const char *
+GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid)
+{
+ static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
+
+ GNUNET_CRYPTO_hash_to_enc (&pid->hashPubKey, &ret);
+ return (const char *) ret.encoding;
+}
/**