message: Make msg_dup() copy and msg_destroy() free the file name.
[pspp-builds.git] / src / libpspp / msg-locator.c
index 3e915382739515a6980b2d8611f7fc58cd8ae438..fb8082e9217f6d7d4614b35e9a347761e8ad356a 100644 (file)
 
 #include <config.h>
 #include <stdlib.h>
-#include <libpspp/alloc.h>
 #include "msg-locator.h"
-#include <libpspp/message.h>
 #include <libpspp/assertion.h>
+#include <libpspp/cast.h>
+#include <libpspp/message.h>
 #include "getl.h"
 
+#include "xalloc.h"
+
 /* File locator stack. */
 static const struct msg_locator **file_loc;
 
@@ -76,7 +78,7 @@ get_msg_location (const struct source_stream *ss, struct msg_locator *loc)
     }
   else
     {
-      loc->file_name = getl_source_name (ss);
+      loc->file_name = CONST_CAST (char *, getl_source_name (ss));
       loc->line_number = getl_source_location (ss);
     }
 }