Remark about strong exception safety of strcatdup

This is as good as it gets.
This commit is contained in:
Aaron Puchert 2016-04-26 22:38:11 +02:00
parent 4aa4a67450
commit e2c7b61d33
1 changed files with 2 additions and 0 deletions

View File

@ -152,6 +152,8 @@ int copy_stream(FILE* in, FILE* out) {
}
// append to a malloc'd string
// If reallocation fails, the pointer p remains unchanged, and the data will
// not be freed. (strong exception safety)
//
int strcatdup(char*& p, char* buf) {
char* new_p = (char*)realloc(p, strlen(p) + strlen(buf)+1);