libpurple/protocols/zephyr/ZPeekPkt.c

Tue, 21 Jan 2025 10:44:24 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Tue, 21 Jan 2025 10:44:24 -0600
branch
release-2.x.y
changeset 43153
2e4624a59df5
parent 31294
73607ab89c6f
child 40628
4266008a7791
permissions
-rw-r--r--

zephyr: Modernize K&R function prototypes

This is a backport of 811f82db29dd, as GCC and/or Clang is warning how these are outdated and unsupported for C23.

Testing Done:
Compiled with GCC 15 without `-Wold-style-prototype` warnings raised.

Reviewed at https://reviews.imfreedom.org/r/3775/

/* This file is part of the Project Athena Zephyr Notification System.
 * It contains source for ZPeekPacket function.
 *
 *	Created by:	Robert French
 *
 *	Copyright (c) 1987 by the Massachusetts Institute of Technology.
 *	For copying and distribution information, see the file
 *	"mit-copyright.h".
 */

#include "internal.h"

Code_t
ZPeekPacket(char **buffer, int *ret_len, struct sockaddr_in *from)
{
    Code_t retval;
    struct _Z_InputQ *nextq;

    if ((retval = Z_WaitForComplete()) != ZERR_NONE)
	return (retval);

    nextq =Z_GetFirstComplete();

    *ret_len = nextq->packet_len;

    if (!(*buffer = (char *) malloc((unsigned) *ret_len)))
	return (ENOMEM);

    (void) memcpy(*buffer, nextq->packet, *ret_len);

    if (from)
	*from = nextq->from;

    return (ZERR_NONE);
}

mercurial