mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 15:30:02 +00:00
lib, vtysh: reduce unneccessary C extension usage
We're only supporting GCC, Clang and ICC; but there's no reason to use nonstandard C constructs if they don't actually provide any benefit. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 71f55f38cb3dd804176e7f382f52b75ddcd437de)
This commit is contained in:
parent
744f468530
commit
f03db93b27
@ -148,7 +148,7 @@ buffer_add (struct buffer *b)
|
|||||||
{
|
{
|
||||||
struct buffer_data *d;
|
struct buffer_data *d;
|
||||||
|
|
||||||
d = XMALLOC(MTYPE_BUFFER_DATA, offsetof(struct buffer_data, data[b->size]));
|
d = XMALLOC(MTYPE_BUFFER_DATA, offsetof(struct buffer_data, data) + b->size);
|
||||||
d->cp = d->sp = 0;
|
d->cp = d->sp = 0;
|
||||||
d->next = NULL;
|
d->next = NULL;
|
||||||
|
|
||||||
|
@ -231,9 +231,12 @@ static void log_it(const char *line)
|
|||||||
{
|
{
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
struct tm *tmp = localtime(&t);
|
struct tm *tmp = localtime(&t);
|
||||||
const char *user = getenv("USER") ? : "boot";
|
const char *user = getenv("USER");
|
||||||
char tod[64];
|
char tod[64];
|
||||||
|
|
||||||
|
if (!user)
|
||||||
|
user = "boot";
|
||||||
|
|
||||||
strftime(tod, sizeof tod, "%Y%m%d-%H:%M.%S", tmp);
|
strftime(tod, sizeof tod, "%Y%m%d-%H:%M.%S", tmp);
|
||||||
|
|
||||||
fprintf(logfile, "%s:%s %s\n", tod, user, line);
|
fprintf(logfile, "%s:%s %s\n", tod, user, line);
|
||||||
|
Loading…
Reference in New Issue
Block a user