Commit Graph

32 Commits

Author SHA1 Message Date
Philip Withnall
41691cc4c8 Merge branch 'more-spdx' into 'main'
Add more SPDX license headers

See merge request GNOME/glib!2706
2022-07-05 11:06:49 +00:00
Philip Withnall
fbdbbfa580 gobject-query: Add a --version argument
This has been documented in `man gobject-query` for a long time, but
seemingly never implemented.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:25:35 +01:00
Philip Withnall
6211e25953 gobject-query: Combine two identical if-branches
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:23:11 +01:00
Philip Withnall
ad77557277 gobject-query: Print --help output to stdout rather than stderr
UNIX tools print `--help` output to stdout by convention.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:22:51 +01:00
Philip Withnall
993f3f4407 gobject-query: Make a --help string slightly more helpful
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:06:25 +01:00
Philip Withnall
98e6ac788e gobject-query: Remove extraneous blank line between each output line
I don’t think it improves the output format.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:06:03 +01:00
Philip Withnall
91ff469f7e gobject-query: Use proper Unicode tree drawing characters
This makes the output a lot nicer to read:
```
│
├void
│
├GInterface
│ │
│ └GTypePlugin
│
├gchar
⋮
```
rather than
```
|
`void
|
`GInterface
  |
  `GTypePlugin
|
`gchar
⋮
```

It includes a change to correctly use vertical tees at the top level by
correctly setting the sibling node rather than always setting it to
zero.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 13:04:49 +01:00
Philip Withnall
17a1c29850 gobject-query: Delete unused code
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-09 12:51:06 +01:00
Philip Withnall
26409f19cd Add SPDX license headers for LGPL-2.1-or-later to various files
These have all been added manually, as I’ve finished all the files which
I can automatically detect.

All the license headers in this commit are for LGPL-2.1-or-later, and
all have been double-checked against the license paragraph in the file
header.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-06-01 12:44:23 +01:00
Philip Withnall
3ea4ba31a1 tools: Fix handling of empty argv in various minor GLib tools
This won’t really affect anything, but we might as well fix them to not
crash if called with an empty `argv` by someone (ab)using `execve()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-11 14:45:42 +00:00
Simon McVittie
7a903bd044 Spelling: fix spelling of specify
Detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 14:34:48 +01:00
Sébastien Wilmet
6b948d9613 gobject/: LGPLv2+ -> LGPLv2.1+
All gobject/*.{c,h} files have been processed.

gmarshal.c and gmarshal.h don't have a license header.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-24 11:58:19 +02:00
Philip Withnall
6d030ea0ae gobject: Mark a helper variable as const
It’s only used for argv values, which are not modified here.

https://bugzilla.gnome.org/show_bug.cgi?id=614684
2015-03-04 08:55:30 +00:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Dan Winship
158dde0507 Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX
In Windows development environments that have it, <unistd.h> is mostly
just a wrapper around several other native headers (in particular,
<io.h>, which contains read(), close(), etc, and <process.h>, which
contains getpid()). But given that some Windows dev environments don't
have <unistd.h>, everything that uses those functions on Windows
already needed to include the correct Windows header as well, and so
there is never any point to including <unistd.h> on Windows.

Also, remove some <unistd.h> includes (and a few others) that were
unnecessary even on unix.

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:25:39 -05:00
Ryan Lortie
1dc774a653 Remove g_type_init() calls
Very many testcases, some GLib tools (resource compiler, etc) and
GApplication were calling g_type_init().

Remove those uses, as they are no longer required.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Matthias Clasen
6b4da7c5e1 Use the right binary name in help output. Patch by Hiroyuki Ikezoe.
* gobject-query.c: Use the right binary name in help output.
        Patch by Hiroyuki Ikezoe.


svn path=/trunk/; revision=7164
2008-07-06 02:01:56 +00:00
Michael Natterer
5602b7e275 moved includes back to the top of the files (before gtk-doc SECTION
2008-06-22  Michael Natterer  <mitch@imendio.com>

	* *.c: moved includes back to the top of the files (before gtk-doc
	SECTION comments). Add "config.h" in all files and move system
	included before glib includes. Remove trailing whitespace from
	SECTION comments and did some reformatting where lines were overly
	long, no documentation content was changed.


svn path=/trunk/; revision=7089
2008-06-22 14:29:25 +00:00
Matthias Clasen
d98433b85e Silence compiler warnings.
2005-11-28  Matthias Clasen  <mclasen@redhat.com>

	* gobjectnotifyqueue.c (g_object_notify_queue_thaw):
	* gobject-query.c (main): Silence compiler warnings.

	* glib-genmarshal.c (main): Use G_N_ELEMENTS.
2005-11-28 20:33:53 +00:00
Matthias Clasen
9bd80d9cb4 Cosmetic fixes (#163792, Benoît Carpentier):
2005-01-12  Matthias Clasen  <mclasen@redhat.com>

	Cosmetic fixes (#163792, Benoît Carpentier):

	* gobject-query.c (main): Remove duplicate lines.

	* gvaluetransform.c: Remove duplicate definitions of
	value_transform_[u]int64_[u]int64.
2005-01-12 17:27:18 +00:00
Tim Janik
de059b53bc fix iterating over fundamental types.
Tue Sep  2 14:53:41 2003  Tim Janik  <timj@gtk.org>

        * gobject-query.c (main): fix iterating over fundamental types.

        * gtype.c: applied patch from owen which keeps internal
        class initialization state to maintain class and interface
        initialization happen in the order of:
        1. class' base_init
        2. interface' base_init
        =  interfaces added after here are immediately base_init-ialized
        3. class_init
        4. Interface_init
        =  interfaces added here are immediately Interface_init-ialized
2003-09-02 12:58:23 +00:00
Matthias Clasen
37e7e80e5b Add a test for positional parameters in g_snprintf(). Use g_printf()
* tests/string-test.c: Add a test for positional parameters in
	g_snprintf().
	* glib-genmarshal.c, gobject-query.c: Use g_printf() instead of
	system printf.  (#99319)
2002-12-12 23:52:29 +00:00
Tim Janik
aafb9e4ba9 use g_type_check_is_value_type() instead of g_type_value_table_peek().
Thu Nov 22 03:30:57 2001  Tim Janik  <timj@gtk.org>

        * gvalue.h (G_TYPE_IS_VALUE): use g_type_check_is_value_type()
        instead of g_type_value_table_peek().

        * gtype.[hc] (type_check_is_value_type_U): speed up check
        LOCK-less by caching lookups in node->mutatable_has_value_table.

        * gtype.[hc]: removed locks where possible. partly based on
        patches from owen and alex.
2001-11-22 03:20:07 +00:00
Owen Taylor
f571f74616 Remove debug flag argument to g_type_init() and add
Thu Jun 28 22:49:40 2001  Owen Taylor  <otaylor@redhat.com>

	* gtype.[ch] gobject-query.c testgruntime.c: Remove
	debug flag argument to g_type_init() and add
	g_type_init_with_debug_flags().
2001-06-29 02:50:46 +00:00
Owen Taylor
1fb8a98a89 Fix mispelling in help output. (#53952, Skip Montanaro)
Thu May 31 17:56:47 2001  Owen Taylor  <otaylor@redhat.com>

	* gobject-query.c: Fix mispelling in help output.
	(#53952, Skip Montanaro)
2001-05-31 21:57:35 +00:00
Tim Janik
37e4b8c87e changed prototype of g_boxed_type_register_static() to contain an optional
Wed Mar  7 09:36:33 2001  Tim Janik  <timj@gtk.org>

	* gboxed.[hc]: changed prototype of g_boxed_type_register_static()
	to contain an optional init function and a hint at whether the
	boxed structure uses ref counting internally.
	added g_value_set_boxed_take_ownership().
	made G_TYPE_BOXED an abstract value type.

	* genums.[hc]: made G_TYPE_ENUM and G_TYPE_FLAGS abstract value
	types.

	* glib-genmarshal.c: argument type changes, preparation for third-party
	arg specification.

	* gobject.[hc]: cleaned up get/set property code.
	added g_strdup_value_contents() to improve warnings.

	* gparam.[hc]: added g_param_value_convert(), taking over responsibility
	of the old g_value_convert(). added G_PARAM_LAX_VALIDATION flag so
	validation alterations may be valid a part of the property setting
	process.

	* gparamspecs.[hc]: made value comparisons stable (for sort applications).
	added GParamSpecValueArray, a param spec for value arrays and
	GParamSpecClosure. nuked the value exchange functions and
	GParamSpecCCallback.

	* gtype.[hc]: catch unintialized usages of the type system with
	g_return_val_if_uninitialized(). introduced G_TYPE_FLAG_VALUE_ABSTRACT
	to flag types that introduce a value table, but can't be used for
	g_value_init(). cleaned up reserved type ids.

	* gvalue.[hc]: code cleanups and saner checking.
	nuked the value exchange API. implemented value transformations, we
	can't really "convert" values, rather transforms are an anylogy to
	C casts, real conversions need a param spec for validation, which is
	why g_param_value_convert() does real conversions now.

	* gvaluearray.[hc]: new files that implement a GValueArray, a struct
	that can hold inhomogeneous arrays of value (to that extend that it
	also allowes undefined values, i.e. G_VALUE_TYPE(value)==0).
	this is exposed to the type system as a boxed type.

	* gvaluetransform.c: new file implementing most of the former value
	exchange functions as single-sided transformations.

	* gvaluetypes.[hc]: nuked G_TYPE_CCALLBACK, added
	g_value_set_string_take_ownership().

	* *.h: s/G_IS_VALUE_/G_VALUE_HOLDS_/.

	* *.[hc]: many fixes and cleanups.

	* many warning improvements.

Tue Feb 27 18:35:15 2001  Tim Janik  <timj@gtk.org>

	* gobject.c (g_object_get_valist): urg, pass G_VALUE_NOCOPY_CONTENTS
	into G_VALUE_LCOPY(), this needs proper documenting.

	* gparam.c: fixed G_PARAM_USER_MASK.

	* gtype.c (type_data_make_W):
	(type_data_last_unref_Wm): fixed invalid memory freeing.

	* gobject.c (g_object_last_unref): destroy signal handlers associated
	with object, right before finalization.

	* gsignal.c (g_signal_parse_name): catch destroyed nodes or signals
	that don't actually support details.

	* gobject.[hc]: got rid of property trailers. nuked GObject
	properties "data" and the "signal" variants.
	(g_object_connect): new convenience function to do multiple
	signal connections at once.
	(g_object_disconnect): likewise, for disconnections.

	* gparam.[hc] (g_param_spec_pool_lookup): took out trailer support.

	* gvalue.[hc]: marked g_value_fits_pointer() and g_value_peek_pointer()
	as private (the latter got renamed from g_value_get_as_pointer()).

Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>

        * glib-object.h: add gvaluearray.h.

        * gstring.[hc]: fixup naming of g_string_sprint*.

        * gtypes.h: fixed GCompareDataFunc naming.

Wed Mar  7 09:33:27 2001  Tim Janik  <timj@gtk.org>

        * gobject/Makefile.am: shuffled rules to avoid excessive
        rebuilds.

        * gobject/gobject-sections.txt: updates.

        * gobject/tmpl/*: bunch of updates, added another patch
        from Eric Lemings <eric.b.lemings@lmco.com>.
2001-03-07 14:46:45 +00:00
Havoc Pennington
1c391cc698 include string.h
2001-02-17  Havoc Pennington  <hp@pobox.com>

	* gthread.c: include string.h

        Applied patch from Soeren Sandmann:

	* testglib.c: const fixes

	* gwin32.h: format cleanups

	* gutils.c (g_atexit): constify a variable
	(g_find_program_in_path): constification
	(g_basename): G_CONST_RETURN
	(g_path_skip_root): G_CONST_RETURN
	(g_getenv): G_CONST_RETURN
	(g_get_user_name): G_CONST_RETURN
	(g_get_real_name): G_CONST_RETURN
	(g_get_home_dir): G_CONST_RETURN
	(g_get_tmp_dir): G_CONST_RETURN
	(g_get_prgname): G_CONST_RETURN
	(_glib_gettext): G_CONST_RETURN

	* gunicode.h: formatting cleanups

	* gstrfuncs.c (g_strerror): G_CONST_RETURN
	(g_strsignal): G_CONST_RETURN

	* gspawn.c (g_execute): const on variables

	* gmessages.c (printf_string_upper_bound): fix const on a variable

	* gmem.c (g_mem_chunk_new): make the "name" arg const
	(struct _GRealMemChunk): make the "name" field const

	* gfileutils.c (g_file_open_tmp): store const return in a const
	gchar* variable

	* gdataset.c (g_quark_to_string): G_CONST_RETURN

2001-02-17  Havoc Pennington  <hp@pobox.com>

        Applied patch from Soeren Sandmann:

	* gvaluetypes.c (g_value_get_string): G_CONST_RETURN

	* gtype.c (g_type_name): G_CONST_RETURN

	* gsignal.c (g_signal_name): G_CONST_RETURN

	* gobject-query.c (main): const fix

2001-02-17  Havoc Pennington  <hp@pobox.com>

        Applied patch from Soeren Sandmann:

	* gmodule.c (g_module_error): G_CONST_RETURN
	(g_module_name): G_CONST_RETURN
2001-02-17 23:30:48 +00:00
Tim Janik
22357542e9 s/glib_trap_/g_trap_/. add comments on g_trap_instance_signals,
Sun Feb  4 07:38:32 2001  Tim Janik  <timj@gtk.org>

        * docs/debugging.txt: s/glib_trap_/g_trap_/. add comments on
        g_trap_instance_signals, g_trace_instance_signals and
        GRUNTIME_DEBUG.

        * gmem.c: s/glib_trap_/g_trap_/.

Sun Feb  4 07:30:53 2001  Tim Janik  <timj@gtk.org>

        * gtype.[hc]: changed g_type_init() to take debugging flags
        initially, a combination of G_TYPE_DEBUG_OBJECTS and
        G_TYPE_DEBUG_SIGNALS. using the G_TYPE_ prefix is a bit odd
        here, but basically g_type_int() serves as initialization
        fucntion for all of GType, GObject, GSignal, so what the heck.

        * gobject.c: special case debugging code properly.
        changed glib_trap_object_ref to g_trap_object_ref.

        * gsignal.c: add signal emission debugging abilities, along with
        a new trap object g_trap_instance_signals.
2001-02-04 07:03:52 +00:00
Tim Janik
ee23c09e83 added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000  Tim Janik  <timj@gtk.org>

        * glib-object.h: added newly added gobject/ headers.

        * gmesage.c: print g_message() output to stderr instead of stdout.

Wed Oct 25 20:27:02 2000  Tim Janik  <timj@gtk.org>

        * gtype.c (g_type_free_instance): for the moment, freeing object
        structures will fill their memory portion with 0xAA. there's a
        FIXME there, remove this line at a later point.

Tue Oct 24 23:10:26 2000  Tim Janik  <timj@gtk.org>

        * glib-genmarshal.1:
        * glib-genmarshal.c: added publically installed marshaller generator.

        * gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
        interface VTable from instances.

Mon Oct 23 08:28:15 2000  Tim Janik  <timj@gtk.org>

        * gobject.[hc]: new functions for closure maintenance:
        (g_object_watch_closure): maintain validity of the object and
        the closure for objects that are used as data part of a closure.
        (g_cclosure_new_object): convenience function to create C closures
        that have an object as data argument.
        (g_closure_new_object): convenience function to create closures
        that have an object as data argument.

        * gclosure.[hc]: implementation of GClosure mechanism.
        a closure is basically an encapsulation of a callback function
        and its environment. ideally, most places supporting callback
        functions will simply take a GClosure* pointer and thus unify
        callback environments wrg destroy notification etc.
        GClosure provides destroy notifiers for arbitrary data pointers,
        reference counting, invalidation notification (it can be invalidated
        which is merely a deactivate state) and a marshallinbg abstraction.
        GCClosure is also provided in these files, they present a specialized
        GClosure implementation for C language callbacks.

        * genum.c: macro cleanups.

        * gboxed.[hc]: new files, for boxed type abstraction.
        (g_boxed_copy): copy a boxed structure
        (g_boxed_free): free a boxed structure
        (g_value_set_boxed):
        (g_value_get_boxed): standard GValue functions for boxed types
        (g_boxed_type_register_static): convenience function for easy
        introduction of new G_TYPE_BOXED derivatives.

        * gparam.[hc]: introduced g_param_type_register_static(), a short hand
        for creation of new GParamSpec derived types.

        * gtype.[hc]: many fixes, introduced ability to flag individual
        type nodes as ABSTRACT upon registration, added value_peek_pointer()
        to the value table to peek at GValue contents as a pointer for types
        that support this. fixed up GValue checks.

        * gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
        to peek at the value contents as pointer.

        * *.[hc]: adaptions to type macro fixes and changes in the type
        registration API.

        * many const corrections over the place.

Sat Oct 21 02:49:56 2000  Tim Janik  <timj@gtk.org>

        * gtype.c (g_type_conforms_to): this function basically behaves like
        and is_a check, except that it _additionally_ features interfaces
        for instantiatable types. enforce this in the second branch as well
        (`type' conforms_to `type') even if `type' is not an interface type.

Fri Oct 20 15:31:04 2000  Tim Janik  <timj@gtk.org>

        * gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.

        * gtype.[hc]:
        * gobject.c:
        * gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
        suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
        and G_TYPE_POINTER.

Mon Aug 21 04:13:37 2000  Tim Janik  <timj@gtk.org>

        * gbsearcharray.[hc]: long standing needed generic implementation
        of a binary searchable, sorted and dynamically sized array.
2000-10-25 20:36:35 +00:00
Elliot Lee
8f2c74a5b2 Fix inclusion of config.h
Fix inclusion of config.h
2000-08-21 23:06:11 +00:00
Tor Lillqvist
f8b6715ab1 Include ../config.h for HAVE_UNISTD_H. Use it to guard inclusion of
2000-07-10  Tor Lillqvist  <tml@iki.fi>

* gobject-query.c: Include ../config.h for HAVE_UNISTD_H. Use it
to guard inclusion of <unistd.h>.

* gtype.h: Fix copy-paste errors in the ifdefs on how to declare a
variable for export. Call the macro GOBJECT_VAR.

* gtype.c: Declare _g_type_fundamental_last for export here, too.
(type_node_any_new): Use only constant expressions for sizeof
operator (for instance MSVC requires this).

* makefile.mingw.in: Define GOBJECT_COMPILATION.
2000-07-10 18:02:51 +00:00
Tim Janik
397ad5881e add reserved fundamental ids for gtk types (for transition time). added
Fri May  5 01:15:48 2000  Tim Janik  <timj@gtk.org>

	* gtype.h: add reserved fundamental ids for gtk types (for transition
	time). added G_TYPE_FUNDAMENTAL_MAX for gtk.

Mon Apr 17 20:45:50 2000  Tim Janik  <timj@gtk.org>

	* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
	n_params prior to destructing them.

Tue Apr 11 04:28:10 2000  Tim Janik  <timj@gtk.org>

	* fixed a couple of bugs in the initial parameter/object
	implementations, after getting beast running on GObject and GValue.

Fri Apr  7 04:27:49 2000  Tim Janik  <timj@gtk.org>

	* glib-gobject.[hc]: completed parameter set/get implementations,
	along with asyncronous parameter changed notification queue.

Sun Apr  2 04:54:36 2000  Tim Janik  <timj@gtk.org>

	* glib-gobject.[hc]: GObject implementation, that is facilities
	for setting/getting quarked data and reference counting.

	* glib-gparamspecs.[hc]: first actuall parameter implementations
	for GLib, so far we have: char, uchar, bool, int, uint, long,
	ulong, enum, flags, float, double, string and object. each of these
	GParamSpecs is a new instantiatable type in its own respect,
	so the .c file derives 13 new types from G_TYPE_PARAM and
	defines over 50 (*2) conversion facilities.

	* glib-gvaluecollector.h: generic varargs handling stubs for
	GParamSpecs, private header file (does get installed for
	inclusion into user code though).

	* glib-gvalue.[hc]: GValue functionality implementation.

	* glib-gparam.[hc]: basis GParamSpec implementation for
	the virtual base type G_TYPE_PARAM.

        * glib-genums.[hc]: enum/flags type implementation, based on
	bseenum.[hc].

	* glib-extra.[hc]: GLib additions, including 1.3 compatibility
	routines and various other functions, from string manipulation
	over list manipulation up to a unix signal GSource.

	* glib-gtype.[hc]: GLib Type System implementation, heavily
	based on BSE's dynamic type system.
2000-05-12 15:22:31 +00:00