[systemd-commits] 2 commits - src/generate-kbd-model-map src/pager.c

Lennart Poettering lennart at kemper.freedesktop.org
Tue Oct 11 06:53:27 PDT 2011


 src/generate-kbd-model-map |   42 +++++++++++++-----------------------------
 src/pager.c                |    2 +-
 2 files changed, 14 insertions(+), 30 deletions(-)

New commits:
commit 30fa6468353443318500c1783f5b1b164a32de0b
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Tue Oct 11 12:34:14 2011 +0200

    localed: shorten generate-kbd-model-map
    
    Output is identical.

diff --git a/src/generate-kbd-model-map b/src/generate-kbd-model-map
index 4fcf785..624c517 100755
--- a/src/generate-kbd-model-map
+++ b/src/generate-kbd-model-map
@@ -1,49 +1,33 @@
 #!/usr/bin/python
 
-import system_config_keyboard.keyboard_models, sys
+import sys
+import system_config_keyboard.keyboard_models
 
 def strdash(s):
-        r = s.strip()
-
-        if r == "":
-                return "-"
-
-        return r
-
-def tab_extend(s, n = 1):
+        return s.strip() or '-'
 
+def tab_extend(s, n=1):
         s = strdash(s)
-        k = len(s) / 8
+        k = len(s) // 8
 
         if k >= n:
                 f = 1
         else:
                 f = n - k
 
-        for x in range(0, f):
-                s = s + "\t"
-
-        return s
-
+        return s + '\t'*f
 
 
 models = system_config_keyboard.keyboard_models.KeyboardModels().get_models()
 
 print "# Generated from system-config-keyboard's model list"
-
 print "# consolelayout\t\txlayout\txmodel\t\txvariant\txoptions"
 
-k = models.keys()
-
-k.reverse()
-
-for key in k:
-        value = models[key]
-
-        options = value[4]
-        if len(options) > 0:
-                options = "terminate:ctrl_alt_bksp," + options
-        else:
-                options = "terminate:ctrl_alt_bksp"
+for key, value in reversed(models.items()):
+        options = "terminate:ctrl_alt_bksp"
+        if value[4]:
+                options += ',' + value[4]
 
-        print "%s%s%s%s%s" % (tab_extend(key, 3), tab_extend(value[1]), tab_extend(value[2], 2), tab_extend(value[3], 2), options)
+        print ''.join((tab_extend(key, 3), tab_extend(value[1]),
+                       tab_extend(value[2], 2), tab_extend(value[3], 2),
+                       options))

commit adda7d8b9715a5090d9189144828ef4d3f51348c
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Tue Oct 11 11:27:06 2011 +0200

    pager: add _noreturn_ to pager_fallback()
    
    src/pager.c: In function ‘pager_fallback’:
    src/pager.c:35:13: warning: function might be possible candidate for attribute ‘noreturn’ [-Wmissing-noreturn]

diff --git a/src/pager.c b/src/pager.c
index 6e2bb49..3fc8182 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -32,7 +32,7 @@
 
 static pid_t pager_pid = 0;
 
-static void pager_fallback(void) {
+_noreturn_ static void pager_fallback(void) {
         ssize_t n;
         do {
                 n = splice(STDIN_FILENO, NULL, STDOUT_FILENO, NULL, 64*1024, 0);



More information about the systemd-commits mailing list