+Thu Jun 29 15:57:28 2000 Owen Taylor <otaylor@redhat.com>
+
+ * NEWS: updated
+
+ * Makefile.am: added snapcheck target to go along with snapshot
+
+ * gstring.c glib.h (g_string_hash): Add g_string_hash to
+ go along with g_string_equal.
+
+Tue Jun 27 12:40:23 EDT 2000 David A. Wheeler <dwheeler@dwheeler.com>
+
+ * glib.h: Added g_string_equal for comparing GStrings;
+ changed g_str_equal so it returns gboolean (instead of gint).
+
+ * gstring.c: Modified GString implementation to support embedded
+ ASCII NUL ('\0') characters, and implemented g_string_equal.
+
+ * testglib.c tests/string-test.c: Added tests for g_string_equal
+ and tests for proper handling of embedded ASCII NUL characters.
+
Wed Jun 28 22:52:00 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am (libglib_la_SOURCES): Fix
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
-
* gutils.c (g_snprintf):
(g_vsnprintf): added argument assertments.
+Thu Jun 29 15:57:28 2000 Owen Taylor <otaylor@redhat.com>
+
+ * NEWS: updated
+
+ * Makefile.am: added snapcheck target to go along with snapshot
+
+ * gstring.c glib.h (g_string_hash): Add g_string_hash to
+ go along with g_string_equal.
+
+Tue Jun 27 12:40:23 EDT 2000 David A. Wheeler <dwheeler@dwheeler.com>
+
+ * glib.h: Added g_string_equal for comparing GStrings;
+ changed g_str_equal so it returns gboolean (instead of gint).
+
+ * gstring.c: Modified GString implementation to support embedded
+ ASCII NUL ('\0') characters, and implemented g_string_equal.
+
+ * testglib.c tests/string-test.c: Added tests for g_string_equal
+ and tests for proper handling of embedded ASCII NUL characters.
+
Wed Jun 28 22:52:00 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am (libglib_la_SOURCES): Fix
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
-
* gutils.c (g_snprintf):
(g_vsnprintf): added argument assertments.
+Thu Jun 29 15:57:28 2000 Owen Taylor <otaylor@redhat.com>
+
+ * NEWS: updated
+
+ * Makefile.am: added snapcheck target to go along with snapshot
+
+ * gstring.c glib.h (g_string_hash): Add g_string_hash to
+ go along with g_string_equal.
+
+Tue Jun 27 12:40:23 EDT 2000 David A. Wheeler <dwheeler@dwheeler.com>
+
+ * glib.h: Added g_string_equal for comparing GStrings;
+ changed g_str_equal so it returns gboolean (instead of gint).
+
+ * gstring.c: Modified GString implementation to support embedded
+ ASCII NUL ('\0') characters, and implemented g_string_equal.
+
+ * testglib.c tests/string-test.c: Added tests for g_string_equal
+ and tests for proper handling of embedded ASCII NUL characters.
+
Wed Jun 28 22:52:00 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am (libglib_la_SOURCES): Fix
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
-
* gutils.c (g_snprintf):
(g_vsnprintf): added argument assertments.
+Thu Jun 29 15:57:28 2000 Owen Taylor <otaylor@redhat.com>
+
+ * NEWS: updated
+
+ * Makefile.am: added snapcheck target to go along with snapshot
+
+ * gstring.c glib.h (g_string_hash): Add g_string_hash to
+ go along with g_string_equal.
+
+Tue Jun 27 12:40:23 EDT 2000 David A. Wheeler <dwheeler@dwheeler.com>
+
+ * glib.h: Added g_string_equal for comparing GStrings;
+ changed g_str_equal so it returns gboolean (instead of gint).
+
+ * gstring.c: Modified GString implementation to support embedded
+ ASCII NUL ('\0') characters, and implemented g_string_equal.
+
+ * testglib.c tests/string-test.c: Added tests for g_string_equal
+ and tests for proper handling of embedded ASCII NUL characters.
+
Wed Jun 28 22:52:00 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am (libglib_la_SOURCES): Fix
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
-
* gutils.c (g_snprintf):
(g_vsnprintf): added argument assertments.
+Thu Jun 29 15:57:28 2000 Owen Taylor <otaylor@redhat.com>
+
+ * NEWS: updated
+
+ * Makefile.am: added snapcheck target to go along with snapshot
+
+ * gstring.c glib.h (g_string_hash): Add g_string_hash to
+ go along with g_string_equal.
+
+Tue Jun 27 12:40:23 EDT 2000 David A. Wheeler <dwheeler@dwheeler.com>
+
+ * glib.h: Added g_string_equal for comparing GStrings;
+ changed g_str_equal so it returns gboolean (instead of gint).
+
+ * gstring.c: Modified GString implementation to support embedded
+ ASCII NUL ('\0') characters, and implemented g_string_equal.
+
+ * testglib.c tests/string-test.c: Added tests for g_string_equal
+ and tests for proper handling of embedded ASCII NUL characters.
+
Wed Jun 28 22:52:00 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am (libglib_la_SOURCES): Fix
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
-
* gutils.c (g_snprintf):
(g_vsnprintf): added argument assertments.
+Thu Jun 29 15:57:28 2000 Owen Taylor <otaylor@redhat.com>
+
+ * NEWS: updated
+
+ * Makefile.am: added snapcheck target to go along with snapshot
+
+ * gstring.c glib.h (g_string_hash): Add g_string_hash to
+ go along with g_string_equal.
+
+Tue Jun 27 12:40:23 EDT 2000 David A. Wheeler <dwheeler@dwheeler.com>
+
+ * glib.h: Added g_string_equal for comparing GStrings;
+ changed g_str_equal so it returns gboolean (instead of gint).
+
+ * gstring.c: Modified GString implementation to support embedded
+ ASCII NUL ('\0') characters, and implemented g_string_equal.
+
+ * testglib.c tests/string-test.c: Added tests for g_string_equal
+ and tests for proper handling of embedded ASCII NUL characters.
+
Wed Jun 28 22:52:00 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am (libglib_la_SOURCES): Fix
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
-
* gutils.c (g_snprintf):
(g_vsnprintf): added argument assertments.
+Thu Jun 29 15:57:28 2000 Owen Taylor <otaylor@redhat.com>
+
+ * NEWS: updated
+
+ * Makefile.am: added snapcheck target to go along with snapshot
+
+ * gstring.c glib.h (g_string_hash): Add g_string_hash to
+ go along with g_string_equal.
+
+Tue Jun 27 12:40:23 EDT 2000 David A. Wheeler <dwheeler@dwheeler.com>
+
+ * glib.h: Added g_string_equal for comparing GStrings;
+ changed g_str_equal so it returns gboolean (instead of gint).
+
+ * gstring.c: Modified GString implementation to support embedded
+ ASCII NUL ('\0') characters, and implemented g_string_equal.
+
+ * testglib.c tests/string-test.c: Added tests for g_string_equal
+ and tests for proper handling of embedded ASCII NUL characters.
+
Wed Jun 28 22:52:00 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am (libglib_la_SOURCES): Fix
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
-
* gutils.c (g_snprintf):
(g_vsnprintf): added argument assertments.
+Thu Jun 29 15:57:28 2000 Owen Taylor <otaylor@redhat.com>
+
+ * NEWS: updated
+
+ * Makefile.am: added snapcheck target to go along with snapshot
+
+ * gstring.c glib.h (g_string_hash): Add g_string_hash to
+ go along with g_string_equal.
+
+Tue Jun 27 12:40:23 EDT 2000 David A. Wheeler <dwheeler@dwheeler.com>
+
+ * glib.h: Added g_string_equal for comparing GStrings;
+ changed g_str_equal so it returns gboolean (instead of gint).
+
+ * gstring.c: Modified GString implementation to support embedded
+ ASCII NUL ('\0') characters, and implemented g_string_equal.
+
+ * testglib.c tests/string-test.c: Added tests for g_string_equal
+ and tests for proper handling of embedded ASCII NUL characters.
+
Wed Jun 28 22:52:00 2000 Owen Taylor <otaylor@redhat.com>
* Makefile.am (libglib_la_SOURCES): Fix
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
-
* gutils.c (g_snprintf):
(g_vsnprintf): added argument assertments.
./sanity_check $(VERSION)
snapshot:
- $(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
+ $(MAKE) dist distdir=$(PACKAGE)-snap`date +"%Y%m%d"`
+
+snapcheck:
+ $(MAKE) distcheck distdir=$(PACKAGE)-snap`date +"%Y%m%d"`
dist-hook:
cp glib.spec $(distdir)
What's new in GLib 1.3.1:
-
+* New GObject library added including object system based on
+ the GTK+ object system.
+* Functions for getting the properties of Unicode characters,
+ computing the canonical decomposition and ordering combining
+ characters aand manipulating UTF-8 string manipulation based
+ on libunicode.
+* GString now properly handles embedded nuls.
* Multiple fixes from the 1.2.x branch.
* Upgrade to libtool 1.3.3
* Full thread support (thread creation and destruction).
GString* g_string_sized_new (guint dfl_size);
void g_string_free (GString *string,
gboolean free_segment);
+gboolean g_string_equal (const GString *v,
+ const GString *v2);
+guint g_string_hash (const GString *str);
GString* g_string_assign (GString *string,
const gchar *rval);
GString* g_string_truncate (GString *string,
/* Hash Functions
*/
-gint g_str_equal (gconstpointer v,
- gconstpointer v2);
-guint g_str_hash (gconstpointer v);
+gboolean g_str_equal (gconstpointer v,
+ gconstpointer v2);
+guint g_str_hash (gconstpointer v);
-gint g_int_equal (gconstpointer v,
- gconstpointer v2);
-guint g_int_hash (gconstpointer v);
+gint g_int_equal (gconstpointer v,
+ gconstpointer v2);
+guint g_int_hash (gconstpointer v);
/* This "hash" function will just return the key's adress as an
* unsigned integer. Useful for hashing on plain adresses or
./sanity_check $(VERSION)
snapshot:
- $(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
+ $(MAKE) dist distdir=$(PACKAGE)-snap`date +"%Y%m%d"`
+
+snapcheck:
+ $(MAKE) distcheck distdir=$(PACKAGE)-snap`date +"%Y%m%d"`
dist-hook:
cp glib.spec $(distdir)
GString* g_string_sized_new (guint dfl_size);
void g_string_free (GString *string,
gboolean free_segment);
+gboolean g_string_equal (const GString *v,
+ const GString *v2);
+guint g_string_hash (const GString *str);
GString* g_string_assign (GString *string,
const gchar *rval);
GString* g_string_truncate (GString *string,
/* Hash Functions
*/
-gint g_str_equal (gconstpointer v,
- gconstpointer v2);
-guint g_str_hash (gconstpointer v);
+gboolean g_str_equal (gconstpointer v,
+ gconstpointer v2);
+guint g_str_hash (gconstpointer v);
-gint g_int_equal (gconstpointer v,
- gconstpointer v2);
-guint g_int_hash (gconstpointer v);
+gint g_int_equal (gconstpointer v,
+ gconstpointer v2);
+guint g_int_hash (gconstpointer v);
/* This "hash" function will just return the key's adress as an
* unsigned integer. Useful for hashing on plain adresses or
/* Hash Functions.
*/
-gint
+gboolean
g_str_equal (gconstpointer v1,
gconstpointer v2)
{
G_UNLOCK (string_mem_chunk);
}
+gboolean
+g_string_equal (const GString *v,
+ const GString *v2)
+{
+ gchar *p, *q;
+ GRealString *string1 = (GRealString *) v;
+ GRealString *string2 = (GRealString *) v2;
+ gint i = string1->len;
+
+ if (i != string2->len)
+ return FALSE;
+
+ p = string1->str;
+ q = string2->str;
+ while (i)
+ {
+ if (*p != *q)
+ return FALSE;
+ p++;
+ q++;
+ i--;
+ }
+ return TRUE;
+}
+
+/* 31 bit hash function */
+guint
+g_string_hash (const GString *str)
+{
+ const gchar *p = str->str;
+ gint n = str->len;
+ guint h = 0;
+
+ while (n--)
+ {
+ h = (h << 5) - h + *p;
+ p++;
+ }
+
+ return h;
+}
+
GString*
g_string_assign (GString *string,
const gchar *rval)
g_memmove (string->str + pos + len, string->str + pos, string->len - pos);
/* insert the new string */
- strncpy (string->str + pos, val, len);
+ g_memmove (string->str + pos, val, len);
string->len += len;
{
GRealString *string = (GRealString *) fstring;
guchar *s;
+ gint n = string->len;
g_return_val_if_fail (string != NULL, NULL);
s = string->str;
- while (*s)
+ while (n)
{
*s = tolower (*s);
s++;
+ n--;
}
return fstring;
{
GRealString *string = (GRealString *) fstring;
guchar *s;
+ gint n = string->len;
g_return_val_if_fail (string != NULL, NULL);
s = string->str;
- while (*s)
+ while (n)
{
*s = toupper (*s);
s++;
+ n--;
}
return fstring;
/* Hash Functions.
*/
-gint
+gboolean
g_str_equal (gconstpointer v1,
gconstpointer v2)
{
G_UNLOCK (string_mem_chunk);
}
+gboolean
+g_string_equal (const GString *v,
+ const GString *v2)
+{
+ gchar *p, *q;
+ GRealString *string1 = (GRealString *) v;
+ GRealString *string2 = (GRealString *) v2;
+ gint i = string1->len;
+
+ if (i != string2->len)
+ return FALSE;
+
+ p = string1->str;
+ q = string2->str;
+ while (i)
+ {
+ if (*p != *q)
+ return FALSE;
+ p++;
+ q++;
+ i--;
+ }
+ return TRUE;
+}
+
+/* 31 bit hash function */
+guint
+g_string_hash (const GString *str)
+{
+ const gchar *p = str->str;
+ gint n = str->len;
+ guint h = 0;
+
+ while (n--)
+ {
+ h = (h << 5) - h + *p;
+ p++;
+ }
+
+ return h;
+}
+
GString*
g_string_assign (GString *string,
const gchar *rval)
g_memmove (string->str + pos + len, string->str + pos, string->len - pos);
/* insert the new string */
- strncpy (string->str + pos, val, len);
+ g_memmove (string->str + pos, val, len);
string->len += len;
{
GRealString *string = (GRealString *) fstring;
guchar *s;
+ gint n = string->len;
g_return_val_if_fail (string != NULL, NULL);
s = string->str;
- while (*s)
+ while (n)
{
*s = tolower (*s);
s++;
+ n--;
}
return fstring;
{
GRealString *string = (GRealString *) fstring;
guchar *s;
+ gint n = string->len;
g_return_val_if_fail (string != NULL, NULL);
s = string->str;
- while (*s)
+ while (n)
{
*s = toupper (*s);
s++;
+ n--;
}
return fstring;
g_print ("ok\n");
+ /* g_string_equal */
+ string1 = g_string_new ("test");
+ string2 = g_string_new ("te");
+ g_assert (! g_string_equal(string1, string2));
+ g_string_append (string2, "st");
+ g_assert (g_string_equal(string1, string2));
+ g_string_free (string1, TRUE);
+ g_string_free (string2, TRUE);
+
+ /* Check handling of embedded ASCII 0 (NUL) characters in GString. */
+ string1 = g_string_new ("fiddle");
+ string2 = g_string_new ("fiddle");
+ g_assert (g_string_equal(string1, string2));
+ g_string_append_c(string1, '\0');
+ g_assert (! g_string_equal(string1, string2));
+ g_string_append_c(string2, '\0');
+ g_assert (g_string_equal(string1, string2));
+ g_string_append_c(string1, 'x');
+ g_string_append_c(string2, 'y');
+ g_assert (! g_string_equal(string1, string2));
+ g_assert (string1->len == 8);
+ g_string_append(string1, "yzzy");
+ g_assert (string1->len == 12);
+ g_assert ( memcmp(string1->str, "fiddle\0xyzzy", 13) == 0);
+ g_string_insert(string1, 1, "QED");
+ g_assert ( memcmp(string1->str, "fQEDiddle\0xyzzy", 16) == 0);
+ g_string_free (string1, TRUE);
+ g_string_free (string2, TRUE);
+
g_print ("checking timers...\n");
-
+
timer = g_timer_new ();
g_print (" spinning for 3 seconds...\n");
g_assert (strcmp (string1->str, "firstlast") == 0);
g_string_free (string1, TRUE);
+ /* g_string_equal */
+ string1 = g_string_new ("test");
+ string2 = g_string_new ("te");
+ g_assert (! g_string_equal(string1, string2));
+ g_string_append (string2, "st");
+ g_assert (g_string_equal(string1, string2));
+ g_string_free (string1, TRUE);
+ g_string_free (string2, TRUE);
+
+ /* Check handling of embedded ASCII 0 (NUL) characters in GString. */
+ string1 = g_string_new ("fiddle");
+ string2 = g_string_new ("fiddle");
+ g_assert (g_string_equal(string1, string2));
+ g_string_append_c(string1, '\0');
+ g_assert (! g_string_equal(string1, string2));
+ g_string_append_c(string2, '\0');
+ g_assert (g_string_equal(string1, string2));
+ g_string_append_c(string1, 'x');
+ g_string_append_c(string2, 'y');
+ g_assert (! g_string_equal(string1, string2));
+ g_assert (string1->len == 8);
+ g_string_append(string1, "yzzy");
+ g_assert (string1->len == 12);
+ g_assert ( memcmp(string1->str, "fiddle\0xyzzy", 13) == 0);
+ g_string_insert(string1, 1, "QED");
+ g_assert ( memcmp(string1->str, "fQEDiddle\0xyzzy", 16) == 0);
+ g_string_free (string1, TRUE);
+ g_string_free (string2, TRUE);
+
return 0;
}
g_print ("ok\n");
+ /* g_string_equal */
+ string1 = g_string_new ("test");
+ string2 = g_string_new ("te");
+ g_assert (! g_string_equal(string1, string2));
+ g_string_append (string2, "st");
+ g_assert (g_string_equal(string1, string2));
+ g_string_free (string1, TRUE);
+ g_string_free (string2, TRUE);
+
+ /* Check handling of embedded ASCII 0 (NUL) characters in GString. */
+ string1 = g_string_new ("fiddle");
+ string2 = g_string_new ("fiddle");
+ g_assert (g_string_equal(string1, string2));
+ g_string_append_c(string1, '\0');
+ g_assert (! g_string_equal(string1, string2));
+ g_string_append_c(string2, '\0');
+ g_assert (g_string_equal(string1, string2));
+ g_string_append_c(string1, 'x');
+ g_string_append_c(string2, 'y');
+ g_assert (! g_string_equal(string1, string2));
+ g_assert (string1->len == 8);
+ g_string_append(string1, "yzzy");
+ g_assert (string1->len == 12);
+ g_assert ( memcmp(string1->str, "fiddle\0xyzzy", 13) == 0);
+ g_string_insert(string1, 1, "QED");
+ g_assert ( memcmp(string1->str, "fQEDiddle\0xyzzy", 16) == 0);
+ g_string_free (string1, TRUE);
+ g_string_free (string2, TRUE);
+
g_print ("checking timers...\n");
-
+
timer = g_timer_new ();
g_print (" spinning for 3 seconds...\n");