Windows: remove trailing whitespace
[openafs.git] / src / WINNT / client_config / misc.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
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  */
9
10 #include <winsock2.h>
11 #include <ws2tcpip.h>
12
13 extern "C" {
14 #include <afs/param.h>
15 #include <afs/stds.h>
16 }
17
18 #include "afs_config.h"
19
20
21 /*
22  * REALLOC ____________________________________________________________________
23  *
24  */
25
26 BOOL AfsConfigReallocFunction (LPVOID *ppTarget, size_t cbElement, size_t *pcTarget, size_t cReq, size_t cInc)
27 {
28    LPVOID pNew;
29    size_t cNew;
30
31    if (cReq <= *pcTarget)
32       return TRUE;
33
34    if ((cNew = cInc * ((cReq + cInc-1) / cInc)) <= 0)
35       return FALSE;
36
37    if ((pNew = (LPVOID)Allocate (cbElement * cNew)) == NULL)
38       return FALSE;
39    memset (pNew, 0x00, cbElement * cNew);
40
41    if (*pcTarget != 0)
42       {
43       memcpy (pNew, *ppTarget, cbElement * (*pcTarget));
44       Free (*ppTarget);
45       }
46
47    *ppTarget = pNew;
48    *pcTarget = cNew;
49    return TRUE;
50 }
51