Встает здесь проблема, пытаясь интегрировать фрагмент кода из ImageMagick в PostgreSQL;две «рамки» используют определение StringInfo - и, конечно, они конфликтуют.
При make, получите эту ошибку:
/usr/include/magick/string_.h:42: error: conflicting types for 'StringInfo'
../../src/include/lib/stringinfo.h:43: error: previous declaration of 'StringInfo' was here
Есть какие-нибудь предложения о том, как я мог бы жениться на этих двух?
typedef struct _StringInfo
{
char
path[MaxTextExtent];
unsigned char
*datum;
size_t
length;
unsigned long
signature;
} StringInfo;
И PostgreSQL хочет сделать это:
typedef struct StringInfoData
{
char *data;
int len;
int maxlen;
int cursor;
} StringInfoData;
typedef StringInfoData *StringInfo;
/*------------------------
* There are two ways to create a StringInfo object initially:
*
* StringInfo stringptr = makeStringInfo();
* Both the StringInfoData and the data buffer are palloc'd.
*
* StringInfoData string;
* initStringInfo(&string);
* The data buffer is palloc'd but the StringInfoData is just local.
* This is the easiest approach for a StringInfo object that will
* only live as long as the current routine.
*
* To destroy a StringInfo, pfree() the data buffer, and then pfree() the
* StringInfoData if it was palloc'd. There's no special support for this.
*
* NOTE: some routines build up a string using StringInfo, and then
* release the StringInfoData but return the data string itself to their
* caller. At that point the data string looks like a plain palloc'd
* string.
*-------------------------
*/
/*------------------------
* makeStringInfo
* Create an empty 'StringInfoData' & return a pointer to it.
*/
extern StringInfo makeStringInfo(void);
/*------------------------
* initStringInfo
* Initialize a StringInfoData struct (with previously undefined contents)
* to describe an empty string.
*/
extern void initStringInfo(StringInfo str);
/*------------------------
* resetStringInfo
* Clears the current content of the StringInfo, if any. The
* StringInfo remains valid.
*/
extern void resetStringInfo(StringInfo str);