|
Should al_get_system_config result be destroyed with al_destroy_config? |
axilmar
Member #1,204
April 2001
|
The manual doesn't say if the ALLEGRO_CONFIG returned by al_get_system_config should be destroyed or not. |
Audric
Member #907
January 2001
|
Yes. al_get_system_config() returns a newly allocated piece of data, it's up to you to release it when you don't need it anymore. |
Peter Wang
Member #23
April 2000
|
No. ALLEGRO_CONFIG *al_get_system_config(void) { return (active_sysdrv) ? active_sysdrv->config : NULL; }
|
Thomas Fjellstrom
Member #476
June 2000
|
Audric said: Yes. al_get_system_config() returns a newly allocated piece of data, it's up to you to release it when you don't need it anymore. Gets tend not to work that way. Typically "create" or "new" type functions you pair up with "destroy" or "delete" functions, where as with a "get" you just leave it be. Not everyone follows that pattern, but its pretty common. -- |
kazzmir
Member #1,786
December 2001
|
I just made a note of this in bf960470dc. |
Audric
Member #907
January 2001
|
Woops sorry. Seeing how the returned pointer was not const, I didn't think this would give direct access. |
Thomas Fjellstrom
Member #476
June 2000
|
Audric said: Seeing how the returned pointer was not const, I didn't think this would give direct access. It's a pointer. You can always directly access the memory it points at. -- |
|