Commit Graph

340 Commits

Author SHA1 Message Date
Pierre Habouzit 4d7a7694ae Calling destructor on splice is wrong, take doesn't want it e.g.
Also fix one assert.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-25 11:04:56 +02:00
Pierre Habouzit b19aace542 Fix draw_align_fromstr calls.
Note that it's undefined to have side effects on an argument and pass this
argument again to another function.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-24 22:40:34 +02:00
Julien Danjou 0aff415f37 version: add GdkPixBuf version
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-24 21:01:24 +02:00
Julien Danjou a055634d4e draw: use len param in draw_align_fromstr()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-24 20:34:02 +02:00
Julien Danjou eb13ebcbf7 version: print compilation options
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-24 20:25:42 +02:00
Pierre Habouzit 17744fc81d Be more on the safe side.
it's useless to escape anything if text_len is 0, also some clients seem
to have a NULL name, so use NONULL(p->priv).

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 18:55:29 +02:00
Julien Danjou fdcc507329 draw: add resize for bg
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 18:07:47 +02:00
Julien Danjou 425c8ea635 util: tokenize a_strtobool() 2008-06-23 18:06:00 +02:00
Julien Danjou 9caa9fc96f draw: add background alignment
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 18:01:15 +02:00
Julien Danjou 236ccc165c placement: fix smart
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 17:30:35 +02:00
Pierre Habouzit 3513e43f0f fix stupid array bug: missing sizeof()
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 17:26:35 +02:00
Pierre Habouzit df89ea2887 Add type and memset safe alloca wrapper. 2008-06-23 16:40:43 +02:00
Pierre Habouzit ef4eae17c4 Split DO_ARRAY in two parts. 2008-06-23 16:40:43 +02:00
Julien Danjou fa2648bf15 Revert "Use gcc to find places needing a a_tokenize call."
Not needed anymore.

This reverts commit 7b7af60dcd.
2008-06-23 15:46:26 +02:00
Pierre Habouzit 3116c0d381 Add draw_parser_data_{init,wipe}.
Use it everywhere needed instead of wrong p_clear's, this fixes memory
leaks.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 15:23:49 +02:00
Julien Danjou cd21e6665b tasklist: tokenize
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 14:12:01 +02:00
Julien Danjou e880f7c11b taglist: use tokenize
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 14:09:00 +02:00
Julien Danjou 4c133bc646 iconbox: use tokenize
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 14:06:37 +02:00
Julien Danjou ab5119732d use more tokenizer, with len
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 14:01:33 +02:00
Julien Danjou f0a01c6131 util: remove useless fuzzy
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 13:41:26 +02:00
Julien Danjou 7803225553 draw: use tokenize() in markup parsing
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 13:39:47 +02:00
Julien Danjou 7dd1fa0e0b draw: rename on_event() to on_element()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 13:32:22 +02:00
Julien Danjou 28830c0dc9 textbox: use tokenize
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 13:24:03 +02:00
Julien Danjou 7aab504350 draw: store parser_data made by extents call
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 13:09:42 +02:00
Julien Danjou 00b119c1ac draw: remove draw_get_image_size()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 12:44:01 +02:00
Pierre Habouzit 7b7af60dcd Use gcc to find places needing a a_tokenize call.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 07:41:22 +02:00
Pierre Habouzit 8d7f45d76a And more gperf.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 07:41:22 +02:00
Pierre Habouzit 4d21d0fd98 Use more gperf stuff.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 07:41:22 +02:00
Pierre Habouzit f423719bd6 use gperf
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 07:41:22 +02:00
Pierre Habouzit c2df807ede Use gperf to tokenize some strings.
This makes the code way more readable, and also avoids a lot of strcmps.

Use it for draw_align_get_from_str as a proof of concept.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 07:41:22 +02:00
Michael Gehring 9206a60e88 cmake: consolidate version strings 2008-06-22 22:13:06 +02:00
Julien Danjou 46f03fd6a6 area_t: make it smaller, use arrays instead of lists.
Make area_t smaller so that it fits in an uint64_t using 4 {u,}int16_t's
for it. Note that xcb uses the very same structure, so we aren't loosing
any information while remaining very small.

This is better to use arrays in term of:
* memory access when iterating over area_t's;
* allocation because area_t's have no *next/*prev members anymore, which
  makes it a tiny structure (8 octets);
* allocation because we allocate area_t's by vector of'em rather than one
  by one.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 22:09:48 +02:00
Pierre Habouzit dc6373488f wipe elements overwritten by a splice
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 22:09:19 +02:00
Pierre Habouzit 3862a626c2 fix typo
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 18:58:52 +02:00
Julien Danjou 901d8db5b6 buffer: add various code documentation
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-22 18:43:04 +02:00
Pierre Habouzit b4b381e947 Finish markup parsing rewrite to avoid mallocs.
For that matter, use elements as a filter for elements we care about, and
let the hook implement whatever it needs without duplicating everything.

The resulting algorithm is still O(n²) where n is the number of filtered
elements (3 at most right now), which isn't bad if we don't need to get
too many elements, but at least it's not quadratic in the number of
attributes anymore.

Speedup improvements could be done using gperf btw.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 17:45:45 +02:00
Pierre Habouzit 37d69b8dcc markup substitutions enhancements.
Do not preemptively allocate a g_markup_escape_text for substitutions,
just remember what we want to substitute markup with, and substitute it in
the final buffer efficiently.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 16:58:56 +02:00
Pierre Habouzit 943e2035fa Rework the markup_parser_* allocation API.
We have a stack, don't be ashamed to use it.

Instead of:

    foo_t *foo;

    foo = foo_new();
    /* work with foo */
    foo_delete(&foo);

It's way better to:

    foo_t foo;

    foo_init(&foo);
    /* work with &foo */
    foo_wipe(&foo);

Remember: more mallocs == more fragmentation.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 16:17:12 +02:00
Pierre Habouzit c3e01fdd43 Add buffer_add_xmlescaped, and malloc--
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 16:02:13 +02:00
Pierre Habouzit 0ad600ef0a And use a buffer in the drawing stuff.
So that we don't stupidly call even more strlen's.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 15:27:06 +02:00
Pierre Habouzit 3fb0b5127e Remove lots and lots of useless mallocs.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 15:20:55 +02:00
Pierre Habouzit 5c601dfd19 Use extensible buffers in markup parsing.
This should avoid quite a few malloc calls.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 15:12:42 +02:00
Pierre Habouzit e25a50774b Add extensible buffers to awesome.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 15:04:09 +02:00
Pierre Habouzit 848a0b1987 add {un,}likely macros
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 14:58:37 +02:00
Pierre Habouzit ea646e7077 Make refcounting safer.
put *item to NULL on unref, as we cannot know if the pointer is valid
after an unref, so just segfault rather than hide a problem.

Also return *item on ref() it allow short versions like:
  foo_list_push(&list, foo_ref(&elem));
which is kind of readable _and_ handy.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 14:22:44 +02:00
Pierre Habouzit 2a5014383d No need to copy the parser each time it's allocated.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 14:22:44 +02:00
Pierre Habouzit f2fd90655e Add a simple array generic type.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 13:52:26 +02:00
Pierre Habouzit f055e4a13b Add p_grow.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 13:30:39 +02:00
Byron Clark 7106c9bcad Stop spamming the log when there is no image present.
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-22 09:46:58 +02:00
Arnaud Fontaine 452b89d6ec Always use unchecked xcb functions 2008-06-21 19:56:51 +09:00