The first error:
Code:
void SetAttr(struct SymEntry *AnEntry, void *Attributes) {
AnEntry->Attributes = malloc(sizeof(Attributes*)); // This doesn't make sense, you're allocating MORE space for a void pointer? You've got room in AnEntry already
AnEntry->Attributes = *Attributes; // You can't dereference void pointers. Cast to the type you want then dereference.
}*snip semi-colon*
The second error:
Code:
void * GetAttr(struct SymEntry *AnEntry) {
void *Att = malloc(sizeof(AnEntry->Attributes));
Att = *(AnEntry->Attributes);
return Att;
}*snip semi-colon*
Not that the extra semi-colons are errors anyway...
Having a rough idea what you're trying to do:
Code:
void SetAttr(struct SymEntry * AnEntry, void * Attributes, size_t len)
{
AnEntry->Attributes = malloc(len);
memcpy(AnEntry->Attributes, Attributes, len); /* careful, pointer members of 'Attributes'
may be free'd later */
}
void * GetAttr(struct SymEntry * AnEntry)
{
return AnEntry->Attributes;
}
Or you could just set Attributes to the passed 'Attributes' argument in SetAttr() and be done with it.