diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-24 18:10:39 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-24 18:10:39 +0000 |
commit | 4e46d04d518f2d6616dde51bc23c1cfefd014750 (patch) | |
tree | 99f1f68a7dd57875c96e86aac01ebb29de93908d /libjava/prims.cc | |
parent | a263d1abcf2eec73c3db2bb9b92f4218f5258313 (diff) | |
download | gcc-4e46d04d518f2d6616dde51bc23c1cfefd014750.tar.gz |
* prims.cc (next_property_value): Never return NULL.
(process_gcj_properties): Copy 'props' before using it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110177 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/prims.cc')
-rw-r--r-- | libjava/prims.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libjava/prims.cc b/libjava/prims.cc index 09bca0b6f71..a968a9b3013 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -857,10 +857,6 @@ next_property_value (char *s, size_t *length) while (isspace (*s)) s++; - // If we've reached the end, return NULL. - if (*s == 0) - return NULL; - // Determine the length of the property value. while (s[l] != 0 && ! isspace (s[l]) @@ -883,13 +879,18 @@ static void process_gcj_properties () { char *props = getenv("GCJ_PROPERTIES"); - char *p = props; - size_t length; - size_t property_count = 0; if (NULL == props) return; + // Later on we will write \0s into this string. It is simplest to + // just duplicate it here. + props = strdup (props); + + char *p = props; + size_t length; + size_t property_count = 0; + // Whip through props quickly in order to count the number of // property values. while (p && (p = next_property_key (p, &length))) |