Ignore:
Timestamp:
Oct 10, 2008, 4:27:38 AM (17 years ago)
Author:
bird
Message:

kmk: More length and alloc optimizations. Made all the length optimizations from yesterday CONFIG_WITH_VALUE_LENGTH instead of KMK.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/kbuild.c

    r1799 r1809  
    17711771    if (!s_fNoCompileCmdsDepsDefined)
    17721772    {
    1773         do_variable_definition(NILF, "_DEPFILES_INCLUDED", pDep->value, o_file, f_append, 0 /* !target_var */);
     1773        do_variable_definition_2(NILF, "_DEPFILES_INCLUDED", pDep->value, pDep->value_length,
     1774                                 pDep->flavor == f_simple, 0, o_file, f_append, 0 /* !target_var */);
    17741775        eval_include_dep(pDep->value, NILF, iVer >= 2 ? incdep_queue : incdep_read_it);
    17751776    }
     
    18011802    memcpy(pszDst, "_CMDS_", sizeof("_CMDS_"));
    18021803    pVar = kbuild_get_recursive_variable(pszSrcVar);
    1803     do_variable_definition(NILF, pszDstVar, pVar->value, o_file, f_simple, 0 /* !target_var */);
     1804    do_variable_definition_2(NILF, pszDstVar, pVar->value, pVar->value_length,
     1805                             pVar->flavor == f_simple, 0, o_file, f_simple, 0 /* !target_var */);
    18041806
    18051807    memcpy(pszSrc, "_OUTPUT", sizeof("_OUTPUT"));
    18061808    memcpy(pszDst, "_OUTPUT_", sizeof("_OUTPUT_"));
    18071809    pVar = kbuild_get_recursive_variable(pszSrcVar);
    1808     pOutput = do_variable_definition(NILF, pszDstVar, pVar->value, o_file, f_simple, 0 /* !target_var */);
     1810    pOutput = do_variable_definition_2(NILF, pszDstVar, pVar->value, pVar->value_length,
     1811                                       pVar->flavor == f_simple, 0, o_file, f_simple, 0 /* !target_var */);
    18091812
    18101813    memcpy(pszSrc, "_OUTPUT_MAYBE", sizeof("_OUTPUT_MAYBE"));
    18111814    memcpy(pszDst, "_OUTPUT_MAYBE_", sizeof("_OUTPUT_MAYBE_"));
    18121815    pVar = kbuild_query_recursive_variable(pszSrcVar);
    1813     pOutputMaybe = do_variable_definition(NILF, pszDstVar, pVar ? pVar->value : "", o_file, f_simple, 0 /* !target_var */);
     1816    if (pVar)
     1817        pOutputMaybe = do_variable_definition_2(NILF, pszDstVar, pVar->value, pVar->value_length,
     1818                                                pVar->flavor == f_simple, 0, o_file, f_simple, 0 /* !target_var */);
     1819    else
     1820        pOutputMaybe = do_variable_definition_2(NILF, pszDstVar, "", 0, 1, 0, o_file, f_simple, 0 /* !target_var */);
    18141821
    18151822    memcpy(pszSrc, "_DEPEND", sizeof("_DEPEND"));
     
    18221829    *psz++ = ' ';
    18231830    memcpy(psz, pSource->value, pSource->value_length + 1);
    1824     do_variable_definition(NILF, pszDstVar, pszVal, o_file, f_simple, 0 /* !target_var */);
    1825     free(pszVal);
     1831    do_variable_definition_2(NILF, pszDstVar, pszVal, pVar->value_length + 1 + pDeps->value_length + 1 + pSource->value_length,
     1832                             pVar->flavor == f_simple && pDeps->flavor == f_simple && pSource->flavor == f_simple,
     1833                             pszVal, o_file, f_simple, 0 /* !target_var */);
    18261834
    18271835    memcpy(pszSrc, "_DEPORD", sizeof("_DEPORD"));
     
    18341842    *psz++ = ' ';
    18351843    memcpy(psz, pOrderDeps->value, pOrderDeps->value_length + 1);
    1836     do_variable_definition(NILF, pszDstVar, pszVal, o_file, f_simple, 0 /* !target_var */);
    1837     free(pszVal);
     1844    do_variable_definition_2(NILF, pszDstVar, pszVal,
     1845                             pVar->value_length + 1 + pDirDep->value_length + 1 + pOrderDeps->value_length,
     1846                             pVar->flavor == f_simple && pDirDep->flavor == f_simple && pOrderDeps->flavor == f_simple,
     1847                             pszVal, o_file, f_simple, 0 /* !target_var */);
    18381848
    18391849    /*
    18401850    _OUT_FILES      += $($(target)_$(source)_OUTPUT_) $($(target)_$(source)_OUTPUT_MAYBE_)
    18411851    */
     1852    /** @todo use append? */
    18421853    pVar = kbuild_get_variable("_OUT_FILES");
    18431854    psz = pszVal = xmalloc(pVar->value_length + 1 + pOutput->value_length + 1 + pOutputMaybe->value_length + 1);
     
    18471858    *psz++ = ' ';
    18481859    memcpy(psz, pOutputMaybe->value, pOutputMaybe->value_length + 1);
    1849     do_variable_definition(NILF, "_OUT_FILES", pszVal, o_file, f_simple, 0 /* !target_var */);
    1850     free(pszVal);
     1860    do_variable_definition_2(NILF, "_OUT_FILES", pszVal,
     1861                             pVar->value_length + 1 + pOutput->value_length + 1 + pOutputMaybe->value_length,
     1862                             pVar->flavor == f_simple && pOutput->flavor == f_simple && pOutputMaybe->flavor == f_simple,
     1863                             pszVal, o_file, f_simple, 0 /* !target_var */);
    18511864
    18521865    /*
     
    18541867    */
    18551868    memcpy(pszDstVar + pTarget->value_length, "_OBJS_", sizeof("_OBJS_"));
    1856     do_variable_definition(NILF, pszDstVar, pObj->value, o_file, f_append, 0 /* !target_var */);
     1869    do_variable_definition_2(NILF, pszDstVar, pObj->value, pObj->value_length,
     1870                             pObj->flavor == f_simple, 0, o_file, f_append, 0 /* !target_var */);
    18571871
    18581872    /*
Note: See TracChangeset for help on using the changeset viewer.