release the pen in MUIM_Hide
[AROS.git] / compiler / alib / easystruct_util.h
blob65d3cb66e07668b3dc80452fdd8826c0c00c4354
1 #ifndef _EASYSTRUCT_UTIL_H
2 #define _EASYSTRUCT_UTIL_H
4 /*
5 Copyright © 2016, The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #include "alib_intern.h"
10 #include <intuition/intuition.h>
11 #include <proto/exec.h>
13 static inline STRPTR CreateFormatStringFromEasyStruct(struct EasyStruct *easyStruct)
15 STRPTR format = NULL;
16 LONG lentext = 0, lengadget = 0;
18 if (easyStruct->es_TextFormat) lentext = STRLEN(easyStruct->es_TextFormat);
19 if (easyStruct->es_GadgetFormat) lengadget = STRLEN(easyStruct->es_GadgetFormat);
21 format = AllocVec(lentext + lengadget + 1, MEMF_PUBLIC);
22 CopyMem(easyStruct->es_TextFormat, format, lentext);
23 CopyMem(easyStruct->es_GadgetFormat, format + lentext, lengadget);
24 format[lentext + lengadget] = '\0';
26 return format;
29 static inline void FreeFormatString(STRPTR format)
31 FreeVec(format);
35 #endif /* _EASYSTRUCT_UTIL_H */