LINUX: afs_create infinite fetchStatus loop
[pkg-k5-afs_openafs.git] / src / WINNT / client_config / misc.cpp
blob2d8883753fe30c8925a8c90a0fdc2eb25675d966
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 #include <winsock2.h>
11 #include <ws2tcpip.h>
13 extern "C" {
14 #include <afs/param.h>
15 #include <afs/stds.h>
18 #include "afs_config.h"
22 * REALLOC ____________________________________________________________________
26 BOOL AfsConfigReallocFunction (LPVOID *ppTarget, size_t cbElement, size_t *pcTarget, size_t cReq, size_t cInc)
28 LPVOID pNew;
29 size_t cNew;
31 if (cReq <= *pcTarget)
32 return TRUE;
34 if ((cNew = cInc * ((cReq + cInc-1) / cInc)) <= 0)
35 return FALSE;
37 if ((pNew = (LPVOID)Allocate (cbElement * cNew)) == NULL)
38 return FALSE;
39 memset (pNew, 0x00, cbElement * cNew);
41 if (*pcTarget != 0)
43 memcpy (pNew, *ppTarget, cbElement * (*pcTarget));
44 Free (*ppTarget);
47 *ppTarget = pNew;
48 *pcTarget = cNew;
49 return TRUE;