]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fri Jun 15 08:53:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 15 Jun 2007 08:18:55 +0000 (08:18 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 15 Jun 2007 08:18:55 +0000 (08:18 +0000)
        * src/internal.h, src/virsh.c: Replace _N with N_ so that
          Solaris builds work (Mark Johnson).
        * src/virsh.c: Add a couple of missing error messages (Mark
          Johnson).
        * python/types.c: Fix NULL pointer deref on DEBUG build
          (Mark Johnson).
        * src/virsh.c: Spelling fix (Mark Johnson).

ChangeLog
python/types.c
src/internal.h
src/virsh.c

index b05cc905a206a5ca37e53185cf237e3306a697b0..50e366b0e159652657517bcaca76777db8c7193f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Fri Jun 15 08:53:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
+
+       * src/internal.h, src/virsh.c: Replace _N with N_ so that
+         Solaris builds work (Mark Johnson).
+       * src/virsh.c: Add a couple of missing error messages (Mark
+         Johnson).
+       * python/types.c: Fix NULL pointer deref on DEBUG build
+         (Mark Johnson).
+       * src/virsh.c: Spelling fix (Mark Johnson).
+
 Thu Jun 14 21:30:28 EST 2007 Daniel Berrange <berrange@redhat.com>
 
        * libvirt.spec.in: Change way extra_release is inserted to
index 4672e1c4df4f18d4e021764d66555a313e5c6853..cc0f2b171d961aa81c9b7fc3f4d595a276579bf9 100644 (file)
@@ -62,13 +62,13 @@ libvirt_charPtrWrap(char *str)
 {
     PyObject *ret;
 
-#ifdef DEBUG
-    printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
-#endif
     if (str == NULL) {
         Py_INCREF(Py_None);
         return (Py_None);
     }
+#ifdef DEBUG
+    printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
+#endif
     ret = PyString_FromString(str);
     free(str);
     return (ret);
@@ -79,13 +79,13 @@ libvirt_constcharPtrWrap(const char *str)
 {
     PyObject *ret;
 
-#ifdef DEBUG
-    printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
-#endif
     if (str == NULL) {
         Py_INCREF(Py_None);
         return (Py_None);
     }
+#ifdef DEBUG
+    printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
+#endif
     ret = PyString_FromString(str);
     return (ret);
 }
@@ -95,13 +95,13 @@ libvirt_charPtrConstWrap(const char *str)
 {
     PyObject *ret;
 
-#ifdef DEBUG
-    printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
-#endif
     if (str == NULL) {
         Py_INCREF(Py_None);
         return (Py_None);
     }
+#ifdef DEBUG
+    printf("libvirt_xmlcharPtrWrap: str = %s\n", str);
+#endif
     ret = PyString_FromString(str);
     return (ret);
 }
index 54c63421f7dc497ac4bd5c731a2badaa2e835e43..20bf251a5ee3f5173511c58f0b30b2dcea06c970 100644 (file)
@@ -23,7 +23,7 @@ extern "C" {
 #endif
 
 #define _(str) dgettext(GETTEXT_PACKAGE, (str))
-#define _N(str) dgettext(GETTEXT_PACKAGE, (str))
+#define N_(str) dgettext(GETTEXT_PACKAGE, (str))
 #define gettext_noop(str) (str)
 
 #ifdef __GNUC__
index 877ed3cc1b3138cacc75b4d054d6c7ec66700c37..ada4b0a9d1d4cc793b177451ebb934efd9a3cfac 100644 (file)
@@ -324,7 +324,7 @@ cmdHelp(vshControl * ctl, vshCmd * cmd)
         vshPrint(ctl, _("Commands:\n\n"));
         for (def = commands; def->name; def++)
             vshPrint(ctl, "    %-15s %s\n", def->name,
-                     _N(vshCmddefGetInfo(def, "help")));
+                     N_(vshCmddefGetInfo(def, "help")));
         return TRUE;
     }
     return vshCmddefHelp(ctl, cmdname, FALSE);
@@ -581,7 +581,7 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
         if (virDomainGetInfo(dom, &info) < 0)
             state = _("no state");
         else
-            state = _N(vshDomainStateToString(info.state));
+            state = N_(vshDomainStateToString(info.state));
 
         vshPrint(ctl, "%3d %-20s %s\n",
                  virDomainGetID(dom),
@@ -603,7 +603,7 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
         if (virDomainGetInfo(dom, &info) < 0)
             state = _("no state");
         else
-            state = _N(vshDomainStateToString(info.state));
+            state = N_(vshDomainStateToString(info.state));
 
         vshPrint(ctl, "%3s %-20s %s\n", "-", names[i], state);
 
@@ -647,7 +647,7 @@ cmdDomstate(vshControl * ctl, vshCmd * cmd)
 
     if (virDomainGetInfo(dom, &info) == 0)
         vshPrint(ctl, "%s\n",
-                 _N(vshDomainStateToString(info.state)));
+                 N_(vshDomainStateToString(info.state)));
     else
         ret = FALSE;
 
@@ -705,7 +705,7 @@ static vshCmdInfo info_create[] = {
 };
 
 static vshCmdOptDef opts_create[] = {
-    {"file", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("file conatining an XML domain description")},
+    {"file", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("file containing an XML domain description")},
     {NULL, 0, 0, NULL}
 };
 
@@ -1383,7 +1383,7 @@ cmdDominfo(vshControl * ctl, vshCmd * cmd)
 
     if (virDomainGetInfo(dom, &info) == 0) {
         vshPrint(ctl, "%-15s %s\n", _("State:"),
-                 _N(vshDomainStateToString(info.state)));
+                 N_(vshDomainStateToString(info.state)));
 
         vshPrint(ctl, "%-15s %d\n", _("CPU(s):"), info.nrVirtCpu);
 
@@ -1469,7 +1469,7 @@ cmdVcpuinfo(vshControl * ctl, vshCmd * cmd)
             vshPrint(ctl, "%-15s %d\n", _("VCPU:"), n);
             vshPrint(ctl, "%-15s %d\n", _("CPU:"), cpuinfo[n].cpu);
             vshPrint(ctl, "%-15s %s\n", _("State:"),
-                     _N(vshDomainVcpuStateToString(cpuinfo[n].state)));
+                     N_(vshDomainVcpuStateToString(cpuinfo[n].state)));
             if (cpuinfo[n].cpuTime != 0) {
                 double cpuUsed = cpuinfo[n].cpuTime;
 
@@ -1487,6 +1487,10 @@ cmdVcpuinfo(vshControl * ctl, vshCmd * cmd)
             }
         }
     } else {
+        if (info.state == VIR_DOMAIN_SHUTOFF) {
+            vshError(ctl, FALSE,
+                 _("Domain shut off, virtual CPUs not present."));
+        }
         ret = FALSE;
     }
 
@@ -1618,6 +1622,7 @@ cmdSetvcpus(vshControl * ctl, vshCmd * cmd)
 
     count = vshCommandOptInt(cmd, "count", &count);
     if (!count) {
+        vshError(ctl, FALSE, _("Invalid number of virtual CPUs."));
         virDomainFree(dom);
         return FALSE;
     }
@@ -1629,7 +1634,7 @@ cmdSetvcpus(vshControl * ctl, vshCmd * cmd)
     }
 
     if (count > maxcpu) {
-        vshError(ctl, FALSE, _("Too many virtual CPU's."));
+        vshError(ctl, FALSE, _("Too many virtual CPUs."));
         virDomainFree(dom);
         return FALSE;
     }
@@ -2865,8 +2870,8 @@ vshCmddefHelp(vshControl * ctl, const char *cmdname, int withprog)
         return FALSE;
     } else {
         vshCmdOptDef *opt;
-        const char *desc = _N(vshCmddefGetInfo(def, "desc"));
-        const char *help = _N(vshCmddefGetInfo(def, "help"));
+        const char *desc = N_(vshCmddefGetInfo(def, "desc"));
+        const char *help = N_(vshCmddefGetInfo(def, "help"));
         const char *syntax = vshCmddefGetInfo(def, "syntax");
 
         fputs(_("  NAME\n"), stdout);
@@ -2897,7 +2902,7 @@ vshCmddefHelp(vshControl * ctl, const char *cmdname, int withprog)
                 else if (opt->type == VSH_OT_DATA)
                     snprintf(buf, sizeof(buf), "<%s>", opt->name);
 
-                fprintf(stdout, "    %-15s  %s\n", buf, _N(opt->help));
+                fprintf(stdout, "    %-15s  %s\n", buf, N_(opt->help));
             }
         }
         fputc('\n', stdout);
@@ -3803,7 +3808,7 @@ vshUsage(vshControl * ctl, const char *cmdname)
 
         for (cmd = commands; cmd->name; cmd++)
             fprintf(stdout,
-                    "    %-15s %s\n", cmd->name, _N(vshCmddefGetInfo(cmd,
+                    "    %-15s %s\n", cmd->name, N_(vshCmddefGetInfo(cmd,
                                                                      "help")));
 
         fprintf(stdout,