[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
uniqstr confusion
From: |
Florian Krohm |
Subject: |
uniqstr confusion |
Date: |
Wed, 4 Aug 2004 23:32:11 -0400 |
User-agent: |
KMail/1.6.2 |
This patch does two related things:
1) It makes sure that the variable current_file is always initialized
with a uniqstr because it is declared as such.
2) It changes the type of the file member of the location type to be a
uniqstr. The function equal_boundaries was assuming that anyway.
Florian
2004-08-04 Florian Krohm <address@hidden>
* src/scan-gram.l (handle_syncline): Use uniqstr_new not xstrdup.
* src/location.h (struct): The file member is a uniqstr.
(equal_boundaries): Use UNIQSTR_EQ for comparison.
Index: src/location.h
===================================================================
RCS file: /cvsroot/bison/bison/src/location.h,v
retrieving revision 1.8
diff -u -r1.8 location.h
--- src/location.h 11 Dec 2002 06:35:35 -0000 1.8
+++ src/location.h 5 Aug 2004 03:27:29 -0000
@@ -21,11 +21,14 @@
#ifndef LOCATION_H_
# define LOCATION_H_
+# include "uniqstr.h"
+
+
/* A boundary between two characters. */
typedef struct
{
/* The name of the file that contains the boundary. */
- char const *file;
+ uniqstr file;
/* The (origin-1) line that contains the boundary. */
int line;
@@ -42,7 +45,7 @@
{
return (a.column == b.column
&& a.line == b.line
- && a.file == b.file);
+ && UNIQSTR_EQ (a.file, b.file));
}
/* A location, that is, a region of source code. */
Index: src/scan-gram.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-gram.l,v
retrieving revision 1.69
diff -u -r1.69 scan-gram.l
--- src/scan-gram.l 3 May 2004 07:42:52 -0000 1.69
+++ src/scan-gram.l 5 Aug 2004 03:27:30 -0000
@@ -1003,7 +1003,7 @@
const char *file = NULL;
file = strchr (args, '"') + 1;
*strchr (file, '"') = 0;
- scanner_cursor.file = current_file = xstrdup (file);
+ scanner_cursor.file = current_file = uniqstr_new (file);
scanner_cursor.line = lineno;
scanner_cursor.column = 1;
}
- uniqstr confusion,
Florian Krohm <=