/* Editor Settings: expandtabs and use 4 spaces for indentation * ex: set softtabstop=4 tabstop=8 expandtab shiftwidth=4: * * -*- mode: c, c-basic-offset: 4 -*- */ /* * Copyright Likewise Software 2004-2008 * All rights reserved. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the license, or (at * your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * General Public License for more details. You should have received a copy * of the GNU Lesser General Public License along with this program. If * not, see . * * LIKEWISE SOFTWARE MAKES THIS SOFTWARE AVAILABLE UNDER OTHER LICENSING * TERMS AS WELL. IF YOU HAVE ENTERED INTO A SEPARATE LICENSE AGREEMENT * WITH LIKEWISE SOFTWARE, THEN YOU MAY ELECT TO USE THE SOFTWARE UNDER THE * TERMS OF THAT SOFTWARE LICENSE AGREEMENT INSTEAD OF THE TERMS OF THE GNU * LESSER GENERAL PUBLIC LICENSE, NOTWITHSTANDING THE ABOVE NOTICE. IF YOU * HAVE QUESTIONS, OR WISH TO REQUEST A COPY OF THE ALTERNATE LICENSING * TERMS OFFERED BY LIKEWISE SOFTWARE, PLEASE CONTACT LIKEWISE SOFTWARE AT * license@likewisesoftware.com */ /* * Copyright (C) Likewise Software. All rights reserved. * * Module Name: * * lwps-def.h * * Abstract: * * Likewise Password Storage (LWPS) * * Common definitions * * Authors: Krishna Ganugapati (krishnag@likewisesoftware.com) * Sriram Nambakam (snambakam@likewisesoftware.com) */ #ifndef __LWPS_DEF_H__ #define __LWPS_DEF_H__ #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifndef WIN32 #define PATH_SEPARATOR_STR "/" #else #define PATH_SEPARATOR_STR "\\" #endif #ifndef WIN32 #define BAIL_ON_LWPS_ERROR(dwError) \ if (dwError) { \ LWPS_LOG_DEBUG("Error at %s:%d [code: %d]",__FILE__,__LINE__,dwError); \ goto error; \ } #endif #define LWPS_SAFE_FREE_STRING(str) \ do { \ if (str) { \ LwpsFreeString(str); \ (str) = NULL; \ } \ } while(0); #define LWPS_SAFE_CLEAR_FREE_STRING(str) \ do { \ if (str) { \ if (*str) { \ memset(str, 0, strlen(str)); \ } \ LwpsFreeString(str); \ (str) = NULL; \ } \ } while(0); #define LWPS_SAFE_FREE_MEMORY(mem) \ do { \ if ((mem)) { \ LwpsFreeMemory((PVOID)(mem)); \ (mem) = NULL; \ } \ } while(0); #define LWPS_SAFE_FREE_STRING_ARRAY(ppszArray) \ do { \ if (ppszArray) { \ LwpsFreeNullTerminatedStringArray(ppszArray); \ (ppszArray) = NULL; \ } \ } while (0); #define IsNullOrEmptyString(str) (!(str) || !(*(str))) #define LWPS_API #ifndef LW_ENDIAN_SWAP16 #define LW_ENDIAN_SWAP16(wX) \ ((((UINT16)(wX) & 0xFF00) >> 8) | \ (((UINT16)(wX) & 0x00FF) << 8)) #endif #ifndef LW_ENDIAN_SWAP32 #define LW_ENDIAN_SWAP32(dwX) \ ((((UINT32)(dwX) & 0xFF000000L) >> 24) | \ (((UINT32)(dwX) & 0x00FF0000L) >> 8) | \ (((UINT32)(dwX) & 0x0000FF00L) << 8) | \ (((UINT32)(dwX) & 0x000000FFL) << 24)) #endif #ifndef LW_ENDIAN_SWAP64 #define LW_ENDIAN_SWAP64(llX) \ (((UINT64)(LW_ENDIAN_SWAP32(((UINT64)(llX) & 0xFFFFFFFF00000000LL) >> 32))) | \ (((UINT64)LW_ENDIAN_SWAP32(((UINT64)(llX) & 0x00000000FFFFFFFFLL))) << 32)) #endif #endif /* __LWPS_DEF_H__ */ /* local variables: mode: c c-basic-offset: 4 indent-tabs-mode: nil tab-width: 4 end: */