Changeset b770d0a in subsurface


Ignore:
Timestamp:
Feb 15, 2015, 6:03:30 AM (3 years ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
Mtest, android_test, dcDownload, foratdotde, gitMerge, gitdebug, gitpictures, ios, master, mergeKirigamiPort, pictimeshift, resolutionIndependence, spinner, testTomaz, testing, v4.5-branch
Children:
27b4d10f
Parents:
e287590
git-author:
Linus Torvalds <torvalds@…> (01/23/15 16:56:34)
git-committer:
Dirk Hohndel <dirk@…> (02/15/15 06:03:30)
Message:

git-access: use the new format_string helpers

It may be a bit less efficient to use a printf-style interface rather
than the explicit malloc and memcpy, but the code ends up simpler and
more readable.

Signed-off-by: Linus Torvalds <torvalds@…>
Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • git-access.c

    re287590 rb770d0a  
    5050         */
    5151        *branchp = filename;
    52         loc = malloc(flen+1);
     52        loc = format_string("%.*s", flen, filename);
    5353        if (!loc)
    5454                return dummy_git_repository;
    55         memcpy(loc, filename, flen);
    56         loc[flen] = 0;
    5755
    58         branch = malloc(blen+1);
     56        branch = format_string("%.*s", blen, filename+flen+1);
    5957        if (!branch) {
    6058                free(loc);
    6159                return dummy_git_repository;
    6260        }
    63         memcpy(branch, filename+flen+1, blen);
    64         branch[blen] = 0;
    6561
    6662        if (stat(loc, &st) < 0 || !S_ISDIR(st.st_mode)) {
Note: See TracChangeset for help on using the changeset viewer.