/* make sure they have enough ram */
-static void checkForRam(void) {
- if (totalMemory()< MIN_RAM) {
+static void checkForRam(int install_method) {
+ char reason_no[] = "";
+ char reason_method[] = " using this install method";
> + char *reason = reason_no;
It would better to use:
const char *reason_no = "";
const char *reason_method = " using this install method";
const char *reason = reason_no;
When you write:
char reason_method[] = " using this install method";
You are asking the compiler to create a const string
" using this install method" in the constant segment, and
to allocate an array on the stack large enough to hold this
string, and upon entering of the function to copy the contents
of the const string to the array on the stack. It would be
better (more efficient) to just pass a pointer around.
Other then this, ack.
+ int needed = MIN_RAM;
+
+ if (install_method == METHOD_URL) {
+ needed += URL_INSTALL_EXTRA_RAM;
+ reason = reason_method;
+ }
+
+ if (totalMemory()< needed) {
char *buf;
checked_asprintf(&buf, _("You do not have enough RAM to install %s "
- "on this machine."), getProductName());
+ "on this machine%s."), getProductName(), reason);