Re: Crashes with builds from today and yesterday



Leonard den Ottolander wrote:
Roland, I have asked you before: Test changes before committing. This
sucks.

Sorry that I have been away from keyboard for so long. I found my mistake and corrected it. After testing that the current patch does not crash mc (at the point my previous patch did) I committed the second try.

I have documented my mistake in HACKING:

----
g_strdup: If you use g_strdup to create a local copy of a string, use
	the following pattern to keep the reference.

	char * const pathref = g_strdup(argument);
	/* ... */
	g_free (pathref);

	The "const" will make the pointer unmodifiable (local_copy++
	is not possible), but you can still modify the string contents.
----

Do you know of any compiler that could not like this construct, that is, take the following as equivalent:?

char * const pathref = g_strdup(argument);
const char * pathref = g_strdup(argument);

If yes, we could do:

#ifdef __GNUC__
typedef char * const stringref;
#else
typedef char *stringref;
#endif

Roland



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]