| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.
This commit was entirely generated using the command:
```
git ls-files glib/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #1415
|
|
|
|
|
|
|
|
|
|
| |
They shouldn’t be used to free a list from part-way through, as that
is confusing and will leave a dangling pointer from the previous list
element.
Spotted by Gary Kramlich in !1653.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|
|
|
| |
Related to issue #3
|
|
|
|
|
|
|
|
| |
As suggested by Simon McVittie and triggered by Marco Trevisan.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
See: https://gitlab.gnome.org/GNOME/glib/merge_requests/818
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although not quite as often-occurring, this should help with constructs
like this:
if (list)
{
g_list_free_full (list, foo);
list = NULL;
}
Closes https://gitlab.gnome.org/GNOME/glib/issues/1943
|
|
|
|
|
|
| |
This makes the g_list_insert_before() follow more closely the guidelines
for GLib, which is to avoid implicit pointer boolean value and to prefer
for over while to improve readability.
|
|
|
|
|
| |
This adds a new insertion helper using a pre-allocated link which may be
advantagous in some situations such as statically linked GList elements.
|
|
|
|
|
|
| |
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://gitlab.gnome.org/GNOME/glib/issues/1492
|
|
|
|
|
|
|
|
| |
Some foreach() functions allow you to modify the object they are
iterating, and others don't, but the docs were not generally clear
about this.
https://bugzilla.gnome.org/show_bug.cgi?id=724383
|
|
|
|
| |
It said list->previous, which is not a thing that exists.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All glib/*.{c,h} files have been processed, as well as gtester-report.
12 of those files are not licensed under LGPL:
gbsearcharray.h
gconstructor.h
glibintl.h
gmirroringtable.h
gscripttable.h
gtranslit-data.h
gunibreak.h
gunichartables.h
gunicomp.h
gunidecomp.h
valgrind.h
win_iconv.c
Some of them are generated files, some are licensed under a BSD-style
license and win_iconv.c is in the public domain.
Sub-directories inside glib/:
deprecated/: processed in a previous commit
glib-mirroring-tab/: already LGPLv2.1+
gnulib/: not modified, the code is copied from gnulib
libcharset/: a copy
pcre/: a copy
tests/: processed in a previous commit
https://bugzilla.gnome.org/show_bug.cgi?id=776504
|
|
|
|
|
|
|
|
|
| |
Just in case people have forgotten their basic algorithms course. Seen
in some pretty terrible code in the wild; hopefully mentioning the cost
in the documentation will make people think twice about using a counter
variable when iterating over a linked list.
https://bugzilla.gnome.org/show_bug.cgi?id=741779
|
|
|
|
|
|
| |
It doesn’t, which is fine, but could be unexpected if undocumented.
https://bugzilla.gnome.org/show_bug.cgi?id=741779
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Despite linked lists being a fairly fundamental computer science
concept, some developers insist on using:
g_list_length (list) > 0
to determine whether a list is non-empty, rather than using:
list != NULL
Add a comment to the documentation for g_list_length() and
g_slist_length() pointing out the better alternative in the hope that it
will prevent some of this abuse.
https://bugzilla.gnome.org/show_bug.cgi?id=741024
|
|
|
|
|
|
| |
Since we are no longer using sgml mode, using /* */ to
escape block comments inside examples does not work anymore.
Switch to using line comments with //
|
|
|
|
|
|
|
|
|
|
| |
Since all element markup is now gone from the doc comments,
we can turn off the gtk-doc sgml mode, which means that from
now on, docbook markup is no longer allowed in doc comments.
To make this possible, we have to replace all remaining
entities in doc comments by their replacement text, & -> &
and so on.
|
|
|
|
| |
These are all replaced by markdown ref links.
|
|
|
|
| |
The C ones, at least.
|
|
|
|
| |
More markup avoidance.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Adds some code examples how functions can be used. Adds a hint
to look at GQueue if access to the start and the end of the list
is required.
applying comments from Emmanuele Bassi and adds some more
improvements to clarify how functions should be used.
https://bugzilla.gnome.org/show_bug.cgi?id=683388
|
|
|
|
|
|
| |
g_list_delete_link was silently ignoring a NULL link before
the last change. Make it do so again, since we've found callers
that rely on this.
|
|
|
|
|
|
|
|
|
| |
We can detect list corruption in some cases. The new test case
demonstrates a case where we can warn instead of silently corrupt
the list. This was pointed out by Steve Grubb.
Also, use the same auxiliary routine in all places where we unlink
a list element.
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=673229
|
|
|
|
|
|
|
|
|
|
|
|
| |
They make a full (deep) copy of a list.
In contrast with g_[s]list_copy(), these functions take a function as a argument
to make a copy of each list element, in addition to copying the list container itself.
The functions g_[s]list_copy() were reimplemented to just call the new functions
with NULL as the function argument, which will behave like current implementation.
https://bugzilla.gnome.org/show_bug.cgi?id=675024
|
|
|
|
|
|
| |
This is a guarantee for the future so that applications can rely on it.
https://bugzilla.gnome.org/show_bug.cgi?id=531973
|
|
|
|
|
| |
Move some things around, make capitalization of short descriptions
more consistent.
|
|
|
|
|
| |
These lines could were not hit by our tests, and examination
of the code reveals that they can't ever be hit.
|
|
|
|
|
|
| |
It looks like this was done just to help people port from gmem to
gslice, but nothing in this header actually requires gslice.h to be
included.
|
|
|
|
|
|
|
|
|
| |
Create a deprecated/ directory that we can start moving ancient chunks
of code to. Start with GAllocator, GMemChunk and related APIs.
Also drop all mention of them from the docs.
https://bugzilla.gnome.org/show_bug.cgi?id=659427
|
|
|
|
|
|
|
| |
This reverts commit 98b667d052b1274f80b8898a32d0753e9e2e5c1a.
The commit was not actually an optimization, since g_list_free is
pretty smart.
|
|
|
|
|
|
| |
No need to iterate the list twice.
Proposed by Luiz Augusto von Dentz,
http://bugzilla.gnome.org/show_bug.cgi?id=653935
|
| |
|
|
|
|
|
| |
g-ir-scanner does not allow a space between the : and the
section name.
|
|
|
|
|
|
|
|
|
| |
Add some helpers for freeing a linked list along with its elements by
providing a GDestroyNotify to call on each of them.
Add a test.
Based on a patch from Cosimo Cecchi.
|
| |
|
| |
|
| |
|
|
|
|
| |
svn path=/trunk/; revision=7023
|
|
|
|
| |
svn path=/trunk/; revision=6810
|
|
|
|
|
|
|
|
|
|
| |
2008-03-01 Benjamin Otte <otte@gnome.org>
* glib/glist.c:
fix last commit.
svn path=/trunk/; revision=6609
|
|
|
|
| |
svn path=/trunk/; revision=6607
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2006-03-20 Matthias Clasen <mclasen@redhat.com>
* glib/gmem.c (profiler_log): use standard_calloc to allocate
the profile_data. (#335209, Chris Wilson)
* glib/gmain.c (g_main_context_unref): Avoid a deadlock.
(#335207, Chris Wilson)
Minor optimizations (#335216, Chris Wilson):
* glib/gasyncqueue.c (g_async_queue_pop_intern_unlocked): Use
g_queue_peek_tail_link instead of g_queue_peek_tail.
* glib/glist.c:
* glib/gslist.c: Avoid some memset calls.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* docs/reference/glib/glib-sections.txt:
* docs/reference/glib/tmpl/linked_lists_double.sgml:
* docs/reference/glib/tmpl/linked_lists_single.sgml:
* glib/glist.[ch]:
* glib/gslist.[ch]:
- Added g_list_insert_sorted_with_data () and
g_slist_insert_sorted_with_data ().
- Removed the extra check in g_list_sort() and g_slist_sort() for
GCompareDataFunc vs. GCompareFunc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mon Dec 5 15:53:20 2005 Tim Janik <timj@imendio.com>
* glib/gslice.c: implement chain walking for arbitrary ->next pointer
offsets in g_slice_free_chain_with_offset() based on a patch by behdad
in bug 323178. moved time consuming logic from g_slice_free() out of
the inner loop, so g_slice_free_chain_with_offset() provides a real
performance benefit over g_slice_free1() now.
* glib/gslice.h: renamed g_slice_free_chain() to
g_slice_free_chain_with_offset(). implemented g_slice_free_chain() as
a type-safe macro as suggested in bug 323178.
simplified the macro implementation of g_slice_free() and implemented
it in a type safe manner for all compliers as suggested by Morten
Welinder <mortenw@gnome.org>.
* glib/gmain.c:
* glib/glist.c:
* glib/gslist.c:
* glib/glib.symbols: s/g_slice_free_chain/g_slice_free_chain_with_offset/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2005-11-04 Matthias Clasen <mclasen@redhat.com>
* glib/Makefile.am: Apply a patch from Behdad Esfahbod to
use a faster lookup table for g_unichar_get_mirror_char().
* glib/gmirroringtable.h: The new table.
* glib/gunichartables.h: Remove bidi_mirroring_table.
* glib/gen-unicode-tables.pl: Don't generate the mirroring
table.
* glib/glib-mirroring-tab/*: Sources for the program
which generated gmirroringtable.h.
* glib/glist.c: Avoid some code duplication.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tue Nov 1 16:24:20 2005 Tim Janik <timj@imendio.com>
* glib/gmem.[hc]: prepared deprecation of GMemChunk and GAllocator.
added g_slice_*() API to allocate and cache small bits of memory.
an actuall allocator implementation for g_slice_*() is still pending.
* glib/gthread.[hc]: changes from a patch by Matthias Clasen.
changed GRealThread list to use in-structure *next; fields instead
of GSList, in order for thread iteration to not depenend on g_slice_*()
indirectly.
_g_thread_mem_private_get():
_g_thread_mem_private_set(): added accessors for private memory,
needed because the ordinary GPrivate implementation relies on GArray
and GSList and therefore indirectly on working g_slice_*() allocations.
* glib/gthread.[hc]:
g_thread_foreach(): new public API function to loop over all existing threads.
* glib/gdataset.c:
* glib/gstring.c:
* glib/gcache.c:
* glib/garray.c:
* glib/gqueue.c:
* glib/gslist.c:
* glib/glist.c:
* glib/ghash.c:
* glib/gtree.c:
* glib/ghook.c:
* glib/gmain.c:
* glib/gnode.c:
removed GAllocator and free list usages and accompanying locks.
use g_slice_*() API to allocate and cache small bits of memory.
* glib/ghook.h: removed GMemChunk field from public API.
* glib/gslist.h:
* glib/glist.h: deprecate allocator API, provide _free1() for consistency.
* glib/gnode.h: deprecate allocator API.
* glib/gmain.c: reordered GPollRec fields so g_slice_free_chain() can
be used for poll rec lists.
* glib/grel.c: removed mem chunk usage, and allocated tuples via g_slice_*().
g_relation_destroy(): free all tuples from the all_tuples hash table,
this effectively maintains the life time track keeping of tuples.
g_relation_delete_tuple(): free tuples which are removed from the
all_tuples hash table. this fixes a temporary leak that was present
in the memchunk code until the destruction of the relation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2005-03-13 Matthias Clasen <mclasen@redhat.com>
Make PLT-reduction work with gcc4, and don't include
everything in galias.h:
* glib/glib.symbols: Group symbols by header and source file.
* glib/makegalias.pl: Protect definitions by the same
preprocessor symbols used to guard the headers. Move
the alias declarations to a separate file which is
produced when calling makegalias.pl -def
* glib/Makefile.am (galiasdef.c): Add a rule to generate this
file.
* glib/*.c: Include galias.h after the other GLib headers,
include galiasdef.c at the bottom.
|
|
|
|
|
|
| |
Thu Sep 16 02:03:15 2004 Matthias Clasen <maclas@gmx.de>
Implement the same PLT reduction technique used in GTK+:
|