зеркало из https://github.com/mozilla/pjs.git
Bug 220062 Cleanup NS_METHOD_GETTER_STR/NS_METHOD_SETTER_STR
r=dougt
This commit is contained in:
Родитель
ad13130117
Коммит
e2795676be
|
@ -88,21 +88,24 @@ _method(_type aResult) \
|
|||
* special for strings to get/set char* strings
|
||||
* using PL_strdup and PR_FREEIF
|
||||
*/
|
||||
#define NS_METHOD_GETTER_STR(_method,_member) \
|
||||
_method(char* *aString)\
|
||||
{\
|
||||
#define NS_METHOD_GETTER_STR(_method,_member) \
|
||||
_method(char* *aString) \
|
||||
{ \
|
||||
if (!aString) return NS_ERROR_NULL_POINTER; \
|
||||
*aString = PL_strdup(_member); \
|
||||
return NS_OK; \
|
||||
if (!(*aString = PL_strdup(_member))) \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#define NS_METHOD_SETTER_STR(_method, _member) \
|
||||
_method(const char *aString)\
|
||||
{\
|
||||
PR_FREEIF(_member);\
|
||||
if (aString) _member = PL_strdup(aString); \
|
||||
else _member = nsnull;\
|
||||
return NS_OK; \
|
||||
_method(const char *aString) \
|
||||
{ \
|
||||
if (_member) PR_Free(_member); \
|
||||
if (!aString) \
|
||||
_member = nsnull; \
|
||||
else if (!(_member = PL_strdup(aString))) \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
/* Getter/Setter macros.
|
||||
|
|
Загрузка…
Ссылка в новой задаче