improve memory management

This commit is contained in:
guinux 2015-01-03 19:32:10 +01:00
parent a85c4272e2
commit 5f1c96e479
4 changed files with 21 additions and 12 deletions

3
.gitignore vendored
View File

@ -1,10 +1,13 @@
pkgbuild pkgbuild
resources/*~
resources/*.c resources/*.c
src/*.c
src/pamac-daemon src/pamac-daemon
src/pamac-tray src/pamac-tray
src/pamac-manager src/pamac-manager
src/pamac-install src/pamac-install
src/pamac-updater src/pamac-updater
src/pamac-refresh
data/polkit/org.manjaro.pamac.policy data/polkit/org.manjaro.pamac.policy
po/*.mo po/*.mo
po/*~ po/*~

View File

@ -42,12 +42,12 @@ namespace Alpm {
double deltaratio; double deltaratio;
int usesyslog; int usesyslog;
public int checkspace; public int checkspace;
Alpm.List<string> cachedirs; Alpm.List<string> *cachedirs;
Alpm.List<string> ignoregroups; Alpm.List<string> *ignoregroups;
public string ignorepkg; public string ignorepkg;
Alpm.List<string> ignorepkgs; Alpm.List<string> *ignorepkgs;
Alpm.List<string> noextracts; Alpm.List<string> *noextracts;
Alpm.List<string> noupgrades; Alpm.List<string> *noupgrades;
public GLib.List<string> holdpkgs; public GLib.List<string> holdpkgs;
public GLib.List<string> syncfirsts; public GLib.List<string> syncfirsts;
public string syncfirst; public string syncfirst;
@ -69,12 +69,18 @@ namespace Alpm {
dbpath = "/var/lib/pacman"; dbpath = "/var/lib/pacman";
gpgdir = "/etc/pacman.d/gnupg/"; gpgdir = "/etc/pacman.d/gnupg/";
logfile = "/var/log/pacman.log"; logfile = "/var/log/pacman.log";
string default_cachedir = "/var/cache/pacman/pkg/";
arch = Posix.utsname().machine; arch = Posix.utsname().machine;
holdpkgs = new GLib.List<string> (); holdpkgs = new GLib.List<string> ();
syncfirsts = new GLib.List<string> (); syncfirsts = new GLib.List<string> ();
syncfirst = ""; syncfirst = "";
Alpm.List.free_all (cachedirs);
Alpm.List.free_all (ignoregroups);
Alpm.List.free_all (ignorepkgs);
Alpm.List.free_all (noextracts);
Alpm.List.free_all (noupgrades);
cachedirs = new Alpm.List<string> (); cachedirs = new Alpm.List<string> ();
cachedirs.add ("/var/cache/pacman/pkg/"); cachedirs->add_str (default_cachedir);
ignoregroups = new Alpm.List<string> (); ignoregroups = new Alpm.List<string> ();
ignorepkgs = new Alpm.List<string> (); ignorepkgs = new Alpm.List<string> ();
ignorepkg = ""; ignorepkg = "";
@ -194,20 +200,20 @@ namespace Alpm {
syncfirsts.append (name); syncfirsts.append (name);
} else if (_key == "CacheDir") { } else if (_key == "CacheDir") {
foreach (string dir in _value.split (" ")) foreach (string dir in _value.split (" "))
cachedirs.add_str (dir); cachedirs->add_str (dir);
} else if (_key == "IgnoreGroup") { } else if (_key == "IgnoreGroup") {
foreach (string name in _value.split (" ")) foreach (string name in _value.split (" "))
ignoregroups.add_str (name); ignoregroups->add_str (name);
} else if (_key == "IgnorePkg") { } else if (_key == "IgnorePkg") {
ignorepkg = _value; ignorepkg = _value;
foreach (string name in _value.split (" ")) foreach (string name in _value.split (" "))
ignorepkgs.add_str (name); ignorepkgs->add_str (name);
} else if (_key == "Noextract") { } else if (_key == "Noextract") {
foreach (string name in _value.split (" ")) foreach (string name in _value.split (" "))
noextracts.add_str (name); noextracts->add_str (name);
} else if (_key == "NoUpgrade") { } else if (_key == "NoUpgrade") {
foreach (string name in _value.split (" ")) foreach (string name in _value.split (" "))
noupgrades.add_str (name); noupgrades->add_str (name);
} }
} else { } else {
foreach (var repo in repo_order) { foreach (var repo in repo_order) {

View File

@ -451,7 +451,7 @@ namespace Pamac {
} }
public async Alpm.List<Alpm.Package?> search_pkgs (string search_string, out Json.Array aur_pkgs) { public async Alpm.List<Alpm.Package?> search_pkgs (string search_string, out Json.Array aur_pkgs) {
Alpm.List<string?> needles = null; var needles = new Alpm.List<string> ();
string[] splitted = search_string.split (" "); string[] splitted = search_string.split (" ");
foreach (unowned string part in splitted) foreach (unowned string part in splitted)
needles.add (part); needles.add (part);

Binary file not shown.