-int _alpm_splitname(const char *target, pmpkg_t *pkg)
+int _alpm_splitname(const char *target, char **name, char **version,
+ unsigned long *name_hash)
/* the format of a db entry is as follows:
+ * package-version-rel/desc (we ignore the filename portion)
* package name can contain hyphens, so parse from the back- go
* two hyphens and we have split the version from the name.
- const char *version, *end;
+ const char *pkgver, *end;
Should we check name/version/name_hash here for being NULL and abort similar
to what was done for pkg previously? Or could it be of use for this
function to be called with those as NULL?
I didn't null check here because
1) Look later in the function; we only set version and name if they are non-NULL
2) in reality, the current two callers guarantee non-NULL for those
arguments, so even that might be overkill.
Sure. If they were checks for NULL there, then checks later in the
function could obviously be removed. But I suppose that one day we
might like to use this just to get the name so version and name_hash
could be passed as NULL.
So ack from me. BTW, the patch needed a minor rebase to apply to the
current head. That is done on my working branch.