Differences From Artifact [04c9933717]:
- File src/of_asprintf.m — part of check-in [c7f0229795] at 2020-01-02 01:51:34 on branch trunk — Update copyright (user: js, size: 16189) [annotate] [blame] [check-ins using] [more...]
To Artifact [0f7da4996c]:
- File
src/of_asprintf.m
— part of check-in
[e0b659378f]
at
2020-03-09 00:54:07
on branch trunk
— of_asprintf.m: Small optimization
Don't replace the decimal point with "." if the decimal point is ".". (user: js, size: 16235) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
350 351 352 353 354 355 356 357 358 359 360 361 362 363 | } static bool formatConversionSpecifierState(struct context *ctx) { char *tmp = NULL; int tmpLen = 0; if (!appendSubformat(ctx, ctx->format + ctx->i, 1)) return false; switch (ctx->format[ctx->i]) { case '@': if (ctx->lengthModifier != LENGTH_MODIFIER_NONE) | > > > | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | } static bool formatConversionSpecifierState(struct context *ctx) { char *tmp = NULL; int tmpLen = 0; #ifndef HAVE_ASPRINTF_L OFString *point; #endif if (!appendSubformat(ctx, ctx->format + ctx->i, 1)) return false; switch (ctx->format[ctx->i]) { case '@': if (ctx->lengthModifier != LENGTH_MODIFIER_NONE) |
︙ | ︙ | |||
549 550 551 552 553 554 555 | #ifndef HAVE_ASPRINTF_L /* * If there's no asprintf_l, we have no other choice than to * use this ugly hack to replace the locale's decimal point * back to ".". */ | > > | < < < | | > > | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | #ifndef HAVE_ASPRINTF_L /* * If there's no asprintf_l, we have no other choice than to * use this ugly hack to replace the locale's decimal point * back to ".". */ point = [OFLocale decimalPoint]; if (!ctx->useLocale && point != nil && ![point isEqual: @"."]) { void *pool = objc_autoreleasePoolPush(); char *tmp2; @try { OFMutableString *tmpStr = [OFMutableString stringWithUTF8String: tmp length: tmpLen]; [tmpStr replaceOccurrencesOfString: point withString: @"."]; if (tmpStr.UTF8StringLength > INT_MAX) return false; tmpLen = (int)tmpStr.UTF8StringLength; tmp2 = malloc(tmpLen); memcpy(tmp2, tmpStr.UTF8String, tmpLen); } @finally { free(tmp); objc_autoreleasePoolPop(pool); } |
︙ | ︙ |